volume

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2020 License: Apache-2.0 Imports: 10 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) ([]lapi.LayerType, error)

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

func SnapSort added in v0.8.0

func SnapSort(snaps []*SnapInfo)

SnapSort sorts a list of snaphosts.

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"`
	Snapshots    []*SnapInfo       `json:"snapshots"`
}

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(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 []lapi.LayerType
	// 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
	// DRBDOpts are the options than can be set on DRBD resources
	DRBDOpts 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, 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 determines the capacity of the underlying storage in Bytes.
	CapacityBytes(ctx context.Context, params map[string]string) (int64, error)
}

Querier retrives various states of volumes.

type SnapInfo added in v0.8.0

type SnapInfo struct {
	Name    string        `json:"name"`
	CsiSnap *csi.Snapshot `json:"csiSnapshot"`
}

SnapInfo provides everything needed to manipulate snapshots.

type SnapshotCreateDeleter added in v0.8.0

type SnapshotCreateDeleter interface {
	SnapCreate(ctx context.Context, snap *SnapInfo) (*SnapInfo, error)
	SnapDelete(ctx context.Context, snap *SnapInfo) error
	GetSnapByName(ctx context.Context, name string) (*SnapInfo, error)
	GetSnapByID(ctx context.Context, ID string) (*SnapInfo, error)
	// List Snapshots should return a sorted list of snapshots.
	ListSnaps(ctx context.Context) ([]*SnapInfo, error)
	// CanonicalizeSnapshotName tries to return a relatively similar version
	// of the suggestedName if the storage backend cannot use the suggestedName
	// in its original form.
	CanonicalizeSnapshotName(ctx context.Context, suggestedName string) string
	// VolFromSnap creats a new volume based on the provided snapshot.
	VolFromSnap(ctx context.Context, snap *SnapInfo, vol *Info) error
	// VolFromVol creats a new volume based on the provided volume.
	VolFromVol(ctx context.Context, sourceVol, 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