volume

package
v0.14.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2021 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const DefaultDisklessStoragePoolName = "DfltDisklessStorPool"

DefaultDisklessStoragePoolName is the hidden diskless storage pool that linstor assigned diskless volumes to if they're not given a user created DisklessStoragePool.

Variables

This section is empty.

Functions

func ParseLayerList added in v0.8.0

func ParseLayerList(s string) ([]devicelayerkind.DeviceLayerKind, error)

ParseLayerList returns a slice of LayerType from a string of space-separated layers.

func Sort added in v0.8.0

func Sort(vols []*Info)

Sort sorts a list of snaphosts.

Types

type Assignment

type Assignment struct {
	Vol *Info
	// Node is the node that the assignment is valid for.
	Node string
	// Path is a location on the Node's filesystem where the volume may be accessed.
	Path string
}

Assignment represents a volume situated on a particular node.

type AttacherDettacher

type AttacherDettacher interface {
	Querier
	Attach(ctx context.Context, vol *Info, node string) error
	Detach(ctx context.Context, vol *Info, node string) error
	NodeAvailable(ctx context.Context, node string) error
	GetAssignmentOnNode(ctx context.Context, vol *Info, node string) (*Assignment, error)
}

AttacherDettacher handles operations relating to volume accessiblity on nodes.

type CreateDeleter

type CreateDeleter interface {
	Querier
	Create(ctx context.Context, vol *Info, req *csi.CreateVolumeRequest) error
	Delete(ctx context.Context, vol *Info) error

	// AccessibleTopologies returns the list of key value pairs volume topologies
	// for the volume or nil if not applicable.
	AccessibleTopologies(ctx context.Context, vol *Info) ([]*csi.Topology, error)
}

CreateDeleter handles the creation and deletion of volumes.

type Expander added in v0.9.0

type Expander interface {
	NodeExpand(source, target string) error
	ControllerExpand(ctx context.Context, vol *Info) error
}

Expander handles the resizing operations for volumes.

type Info

type Info struct {
	Name         string            `json:"name"`
	ID           string            `json:"id"`
	CreatedBy    string            `json:"createdBy"`
	CreationTime time.Time         `json:"creationTime"`
	SizeBytes    int64             `json:"sizeBytes"`
	Readonly     bool              `json:"readonly"`
	Parameters   map[string]string `json:"parameters"`
}

Info provides the everything need to manipulate volumes.

func (*Info) ToAutoPlace added in v0.8.0

func (i *Info) ToAutoPlace() (lapi.AutoPlaceRequest, error)

ToAutoPlace prepares a Info to be deployed by linstor via autoplace.

func (*Info) ToDiskfullResourceCreate added in v0.8.0

func (i *Info) ToDiskfullResourceCreate(node string) (lapi.ResourceCreate, error)

ToDiskfullResourceCreate prepares a Info to be deployed by linstor on a node with local storage.

func (*Info) ToDisklessResourceCreate added in v0.8.0

func (i *Info) ToDisklessResourceCreate(node string) (lapi.ResourceCreate, error)

ToDisklessResourceCreate prepares a Info to be deployed by linstor on a node without local storage.

func (*Info) ToResourceCreateList added in v0.8.0

func (i *Info) ToResourceCreateList() ([]lapi.ResourceCreate, error)

ToResourceCreateList prepares a list of lapi.ResourceCreate to be used to manually assign resources based on the node and client lists of the volume.

type Mounter added in v0.3.0

type Mounter interface {
	Mount(ctx context.Context, vol *Info, source, target, fsType string, readonly bool, options []string) error
	Unmount(target string) error
	IsNotMountPoint(target string) (bool, error)
}

Mounter handles the filesystems located on volumes.

type NodeInformer added in v0.10.0

type NodeInformer interface {
	GetNodeTopologies(ctx context.Context, nodename string) (*csi.Topology, error)
}

type Parameters added in v0.8.0

type Parameters struct {
	// ClientList is a list of nodes where the volume should be assigned to disklessly
	// at the time that the volume is first created.
	ClientList []string
	// NodeList is a list of nodes where the volume should be assigned to diskfully
	// at the time that the volume is first created. Specifying this overrides any
	// other automatic placement rules.
	NodeList []string
	// ReplicasOnDifferent is a list that corresponds to the `linstor resource create`
	// option of the same name.
	ReplicasOnDifferent []string
	// ReplicasOnSame is a list that corresponds to the `linstor resource create`
	// option of the same name.
	ReplicasOnSame []string
	// DisklessStoragePool is the diskless storage pool to use for diskless assignments.
	DisklessStoragePool string
	// DoNotPlaceWithRegex corresponds to the `linstor resource create`
	// option of the same name.
	DoNotPlaceWithRegex string
	// FSOpts is a string of filesystem options passed at mount time.
	FSOpts string
	// MountOpts is a string of mount options passed at mount time. Comma
	// separated like in /etc/fstab.
	MountOpts string
	// StoragePool is the storage pool to use for diskful assignments.
	StoragePool string
	SizeKiB     uint64
	// PlacementCount is the number of replicas of the volume in total.
	PlacementCount int32
	// Disklessonremaining corresponds to the `linstor resource create`
	// option of the same name.
	Disklessonremaining bool
	// Encrypt volumes if true.
	Encryption bool
	// AllowRemoteVolumeAccess if true, volumes may be accessed over the network.
	AllowRemoteVolumeAccess bool
	// LayerList is a list that corresponds to the `linstor resource create`
	// option of the same name.
	LayerList []devicelayerkind.DeviceLayerKind
	// PlacementPolicy determines where volumes are created.
	PlacementPolicy topology.PlacementPolicy
	// PostMountXfsOpts is an optional string of post-mount call
	PostMountXfsOpts string
	// ResourceGroup is the resource-group name in LINSTOR.
	ResourceGroup string
	// Properties are the properties to be set on the resource group.
	Properties map[string]string
}

Parameters configuration for linstor volumes.

func NewParameters added in v0.8.0

func NewParameters(params map[string]string) (Parameters, error)

NewParameters parses out the raw parameters we get and sets appropriate zero values

func (*Parameters) DisklessFlag added in v0.10.0

func (params *Parameters) DisklessFlag() (string, error)

DisklessFlag returns the diskless flag passed to resource create calls. It will select the flag matching the top-most layer that supports disk-less resources.

func (*Parameters) ToResourceGroupModify added in v0.8.2

func (params *Parameters) ToResourceGroupModify(rg *lapi.ResourceGroup) (lapi.ResourceGroupModify, bool, error)

Convert parameters into a modify-object that reconciles any differences between parameters and resource group

type Querier

type Querier interface {
	// ListAll should return a sorted list of pointers to Info.
	ListAll(ctx context.Context) ([]*Info, error)
	// FindByName returns nil when volume is not found.
	FindByName(ctx context.Context, name string) (*Info, error)
	// FindByID returns nil when volume is not found.
	FindByID(ctx context.Context, ID string) (*Info, error)
	// AllocationSizeKiB returns the number of KiB required to provision required bytes.
	AllocationSizeKiB(requiredBytes, limitBytes int64) (int64, error)
	// CapacityBytes returns the amount of free space, in bytes, in the storage pool specified by the params and topology.
	CapacityBytes(ctx context.Context, params, segments map[string]string) (int64, error)
}

Querier retrives various states of volumes.

type SnapshotCreateDeleter added in v0.8.0

type SnapshotCreateDeleter interface {
	// CompatibleSnapshotId returns an ID unique to the suggested name
	CompatibleSnapshotId(name string) string
	SnapCreate(ctx context.Context, id string, sourceVol *Info) (*csi.Snapshot, error)
	SnapDelete(ctx context.Context, snap *csi.Snapshot) error
	// FindSnapByID searches the snapshot in the backend
	// It returns:
	// * the snapshot, nil if not found
	// * true, if the snapshot is either in progress or successful
	// * any error encountered
	FindSnapByID(ctx context.Context, id string) (*csi.Snapshot, bool, error)
	FindSnapsBySource(ctx context.Context, sourceVol *Info, start, limit int) ([]*csi.Snapshot, error)
	// List Snapshots should return a sorted list of snapshots.
	ListSnaps(ctx context.Context, start, limit int) ([]*csi.Snapshot, error)
	// VolFromSnap creates a new volume based on the provided snapshot.
	VolFromSnap(ctx context.Context, snap *csi.Snapshot, vol *Info) error
}

SnapshotCreateDeleter handles the creation and deletion of snapshots.

type VolumeStats added in v0.8.0

type VolumeStats struct {
	AvailableBytes  int64
	TotalBytes      int64
	UsedBytes       int64
	AvailableInodes int64
	TotalInodes     int64
	UsedInodes      int64
}

VolumeStats provides details about filesystem usage.

type VolumeStatter added in v0.8.0

type VolumeStatter interface {
	// GetVolumeStats determines filesystem usage.
	GetVolumeStats(path string) (VolumeStats, error)
}

VolumeStatter provides info about volume/filesystem usage.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL