Documentation ¶
Index ¶
- Constants
- Variables
- func ParseLayerList(s string) ([]devicelayerkind.DeviceLayerKind, error)
- func PrunePattern(sources ...map[string]string) []map[string]string
- type Assignment
- type AttacherDettacher
- type CreateDeleter
- type Expander
- type Info
- type Mounter
- type NodeInformer
- type Parameters
- func (params *Parameters) DisklessFlag() (string, error)
- func (params *Parameters) ToDiskfullResourceCreate(id, node string) (lapi.ResourceCreate, error)
- func (params *Parameters) ToDisklessResourceCreate(id, node string) (lapi.ResourceCreate, error)
- func (params *Parameters) ToResourceCreateList(id string) ([]lapi.ResourceCreate, error)
- func (params *Parameters) ToResourceGroupModify(rg *lapi.ResourceGroup) (lapi.ResourceGroupModify, bool, error)
- type Querier
- type RemoteAccessPolicy
- func (r RemoteAccessPolicy) AccessibleSegments(segments map[string]string) []map[string]string
- func (r RemoteAccessPolicy) MarshalText() (text []byte, err error)
- func (r *RemoteAccessPolicy) Set(s string) error
- func (r *RemoteAccessPolicy) String() string
- func (r *RemoteAccessPolicy) UnmarshalText(text []byte) error
- type RemoteAccessPolicyRule
- type SnapshotCreateDeleter
- type VolumeStats
- type VolumeStatter
Constants ¶
const DefaultDisklessStoragePoolName = "DfltDisklessStorPool"
Variables ¶
var ( // RemoteAccessPolicyAnywhere allows remote access from anywhere RemoteAccessPolicyAnywhere = RemoteAccessPolicy{{}} // RemoteAccessPolicyLocalOnly allows access only to the local node, effectively disabling diskless access. RemoteAccessPolicyLocalOnly = RemoteAccessPolicy{{FromSame: []string{topology.LinstorNodeKey}}} )
var DefaultRemoteAccessPolicy = RemoteAccessPolicyAnywhere
DefaultRemoteAccessPolicy is the access policy used by default when none is specified.
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 PrunePattern ¶ added in v0.17.0
PrunePattern returns the given list of pattern, removed of any duplicates or patterns which are already covered by a more general pattern.
Some examples
[{a:1}, {a:1}] => [{a:1}] [{a:1}, {a:2}] => [{a:1}, {a:2}] [{a:1, b:1}, {a:1}] => [{a:1}] [{a:1, b:1}, {a:1, b:2}] => [{a:1, b:1}, {a:1, b:2}] [{a:1}, {a:1, b:1}, {a:1, b:2}] => [{a:1}]
Types ¶
type Assignment ¶
type Assignment struct { // 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 // ReadOnly indicates if this volume was published as read only. ReadOnly *bool }
Assignment represents a volume situated on a particular node.
type AttacherDettacher ¶
type AttacherDettacher interface { Querier Attach(ctx context.Context, volId, node string, readOnly bool) error Detach(ctx context.Context, volId, node string) error NodeAvailable(ctx context.Context, node string) error FindAssignmentOnNode(ctx context.Context, volId, node string) (*Assignment, error) }
AttacherDettacher handles operations relating to volume accessiblity on nodes.
type CreateDeleter ¶
type CreateDeleter interface { Querier CompatibleVolumeId(name, pvcNamespace, pvcName string) string Create(ctx context.Context, vol *Info, params *Parameters, topologies *csi.TopologyRequirement) error Delete(ctx context.Context, volId string) error // AccessibleTopologies returns the list of key value pairs volume topologies // for the volume or nil if not applicable. AccessibleTopologies(ctx context.Context, volId string, params *Parameters) ([]*csi.Topology, error) // GetLegacyVolumeContext tries to fetch the volume context from legacy properties. GetLegacyVolumeParameters(ctx context.Context, volId string) (*Parameters, 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 Mounter ¶ added in v0.3.0
type Mounter interface { Mount(ctx context.Context, source, target, fsType string, readonly bool, mntOpts, mkfsOpts []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 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 // 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 RemoteAccessPolicy // 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 // UsePvcName derives the volume name from the PVC name+namespace, if that information is available. UsePvcName bool }
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) ToDiskfullResourceCreate ¶ added in v0.16.0
func (params *Parameters) ToDiskfullResourceCreate(id, node string) (lapi.ResourceCreate, error)
ToDiskfullResourceCreate prepares a Info to be deployed by linstor on a node with local storage.
func (*Parameters) ToDisklessResourceCreate ¶ added in v0.16.0
func (params *Parameters) ToDisklessResourceCreate(id, node string) (lapi.ResourceCreate, error)
ToDisklessResourceCreate prepares a Info to be deployed by linstor on a node without local storage.
func (*Parameters) ToResourceCreateList ¶ added in v0.16.0
func (params *Parameters) ToResourceCreateList(id string) ([]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.
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) // 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, pool string, segments map[string]string) (int64, error) }
Querier retrives various states of volumes.
type RemoteAccessPolicy ¶ added in v0.17.0
type RemoteAccessPolicy []RemoteAccessPolicyRule
RemoteAccessPolicy represents a policy for allowing diskless access.
func (RemoteAccessPolicy) AccessibleSegments ¶ added in v0.17.0
func (r RemoteAccessPolicy) AccessibleSegments(segments map[string]string) []map[string]string
AccessibleSegments applies the policy to a specific cluster segment.
func (RemoteAccessPolicy) MarshalText ¶ added in v0.17.0
func (r RemoteAccessPolicy) MarshalText() (text []byte, err error)
func (*RemoteAccessPolicy) Set ¶ added in v0.17.0
func (r *RemoteAccessPolicy) Set(s string) error
Set is used for setting a RemoteAccessPolicy via cli args.
func (*RemoteAccessPolicy) String ¶ added in v0.17.0
func (r *RemoteAccessPolicy) String() string
String is used for settings a RemoteAccessPolicy via cli args.
func (*RemoteAccessPolicy) UnmarshalText ¶ added in v0.17.0
func (r *RemoteAccessPolicy) UnmarshalText(text []byte) error
type RemoteAccessPolicyRule ¶ added in v0.17.0
type RemoteAccessPolicyRule struct {
FromSame []string `yaml:"fromSame,omitempty"`
}
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, params *Parameters, topologies *csi.TopologyRequirement) 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.