Documentation ¶
Index ¶
- func APIClient(c *lc.HighLevelClient) func(*Linstor) error
- func LabelBySP(b bool) func(*Linstor) error
- func LogFmt(fmt logrus.Formatter) func(*Linstor) error
- func LogLevel(s string) func(*Linstor) error
- func LogOut(out io.Writer) func(*Linstor) error
- func PropertyNamespace(ns string) func(*Linstor) error
- type DeleteInProgressError
- type Linstor
- func (s *Linstor) AccessibleTopologies(ctx context.Context, volId string, params *volume.Parameters) ([]*csi.Topology, error)
- func (s *Linstor) AllocationSizeKiB(requiredBytes, limitBytes int64) (int64, error)
- func (s *Linstor) Attach(ctx context.Context, volId, node string, rwxBlock bool) error
- func (s *Linstor) CapacityBytes(ctx context.Context, storagePool string, segments map[string]string) (int64, error)
- func (s *Linstor) CompatibleSnapshotId(name string) string
- func (s *Linstor) CompatibleVolumeId(name, pvcNamespace, pvcName string) string
- func (s *Linstor) ControllerExpand(ctx context.Context, vol *volume.Info) error
- func (s *Linstor) Create(ctx context.Context, vol *volume.Info, params *volume.Parameters, ...) error
- func (s *Linstor) Delete(ctx context.Context, volId string) error
- func (s *Linstor) Detach(ctx context.Context, volId, node string) error
- func (s *Linstor) FindAssignmentOnNode(ctx context.Context, volId, node string) (*volume.Assignment, error)
- func (s *Linstor) FindByID(ctx context.Context, id string) (*volume.Info, error)
- func (s *Linstor) FindSnapByID(ctx context.Context, id string) (*csi.Snapshot, bool, error)
- func (s *Linstor) FindSnapsBySource(ctx context.Context, sourceVol *volume.Info, start, limit int) ([]*csi.Snapshot, error)
- func (s *Linstor) GetLegacyVolumeParameters(ctx context.Context, volId string) (*volume.Parameters, error)
- func (s *Linstor) GetNodeTopologies(ctx context.Context, nodename string) (*csi.Topology, error)
- func (s *Linstor) GetVolumeStats(path string) (volume.VolumeStats, error)
- func (s *Linstor) IsNotMountPoint(target string) (bool, error)
- func (s *Linstor) ListAll(ctx context.Context) ([]*volume.Info, error)
- func (s *Linstor) ListSnaps(ctx context.Context, start, limit int) ([]*csi.Snapshot, error)
- func (s *Linstor) Mount(ctx context.Context, source, target, fsType string, readonly bool, ...) error
- func (s *Linstor) NodeAvailable(ctx context.Context, node string) error
- func (s *Linstor) NodeExpand(source, target string) error
- func (s *Linstor) SnapCreate(ctx context.Context, id, sourceVolId string, params *volume.SnapshotParameters) (*csi.Snapshot, error)
- func (s *Linstor) SnapDelete(ctx context.Context, snap *csi.Snapshot) error
- func (s *Linstor) SortByPreferred(ctx context.Context, nodes []string, remotePolicy volume.RemoteAccessPolicy, ...) ([]string, error)
- func (s *Linstor) Status(ctx context.Context, volId string) ([]string, *csi.VolumeCondition, error)
- func (s *Linstor) Unmount(target string) error
- func (s *Linstor) VolFromSnap(ctx context.Context, snap *csi.Snapshot, vol *volume.Info, ...) error
- type MockStorage
- func (s *MockStorage) AccessibleTopologies(ctx context.Context, volId string, params *volume.Parameters) ([]*csi.Topology, error)
- func (s *MockStorage) AllocationSizeKiB(requiredBytes, limitBytes int64) (int64, error)
- func (s *MockStorage) Attach(ctx context.Context, volId, node string, rwxBlock bool) error
- func (s *MockStorage) CapacityBytes(ctx context.Context, sp string, segments map[string]string) (int64, error)
- func (s *MockStorage) CompatibleSnapshotId(name string) string
- func (s *MockStorage) CompatibleVolumeId(name, pvcNamespace, pvcName string) string
- func (s *MockStorage) ControllerExpand(ctx context.Context, vol *volume.Info) error
- func (s *MockStorage) Create(ctx context.Context, vol *volume.Info, params *volume.Parameters, ...) error
- func (s *MockStorage) Delete(ctx context.Context, volId string) error
- func (s *MockStorage) Detach(ctx context.Context, volId, node string) error
- func (s *MockStorage) FindAssignmentOnNode(ctx context.Context, volId, node string) (*volume.Assignment, error)
- func (s *MockStorage) FindByID(ctx context.Context, id string) (*volume.Info, error)
- func (s *MockStorage) FindSnapByID(ctx context.Context, id string) (*csi.Snapshot, bool, error)
- func (s *MockStorage) FindSnapsBySource(ctx context.Context, sourceVol *volume.Info, start, limit int) ([]*csi.Snapshot, error)
- func (s *MockStorage) GetLegacyVolumeParameters(ctx context.Context, volId string) (*volume.Parameters, error)
- func (s *MockStorage) GetNodeTopologies(_ context.Context, node string) (*csi.Topology, error)
- func (s *MockStorage) GetVolumeStats(path string) (volume.VolumeStats, error)
- func (s *MockStorage) IsNotMountPoint(target string) (bool, error)
- func (s *MockStorage) ListAll(ctx context.Context) ([]*volume.Info, error)
- func (s *MockStorage) ListSnaps(ctx context.Context, start, limit int) ([]*csi.Snapshot, error)
- func (s *MockStorage) Mount(ctx context.Context, source, target, fsType string, readonly bool, ...) error
- func (s *MockStorage) NodeAvailable(ctx context.Context, node string) error
- func (s *MockStorage) NodeExpand(source, target string) error
- func (s *MockStorage) SnapCreate(ctx context.Context, id, sourceVolId string, params *volume.SnapshotParameters) (*csi.Snapshot, error)
- func (s *MockStorage) SnapDelete(ctx context.Context, snap *csi.Snapshot) error
- func (s *MockStorage) Status(ctx context.Context, volId string) ([]string, *csi.VolumeCondition, error)
- func (s *MockStorage) Unmount(target string) error
- func (s *MockStorage) VolFromSnap(ctx context.Context, snap *csi.Snapshot, vol *volume.Info, ...) error
- func (s *MockStorage) VolFromVol(ctx context.Context, sourceVol, vol *volume.Info) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func APIClient ¶ added in v0.8.0
func APIClient(c *lc.HighLevelClient) func(*Linstor) error
APIClient the configured LINSTOR API client that will be used to communicate with the LINSTOR cluster.
func LogFmt ¶ added in v0.8.0
LogFmt sets the format of the log outpout via the provided logrus.Formatter.
func LogLevel ¶ added in v0.8.0
LogLevel sets the logging intensity. Debug additionally reports the function from which the logger was called.
func LogOut ¶ added in v0.8.0
LogOut sets the Linstor client to write logs to the provided io.Writer instead of discarding logs.
func PropertyNamespace ¶ added in v0.21.0
Types ¶
type DeleteInProgressError ¶ added in v0.13.1
func (*DeleteInProgressError) Error ¶ added in v0.13.1
func (d *DeleteInProgressError) Error() string
type Linstor ¶
type Linstor struct {
// contains filtered or unexported fields
}
Linstor is a high-level client for use with CSI.
func NewLinstor ¶
NewLinstor returns a high-level linstor client for CSI applications to interact with By default, it will try to connect with localhost:3370.
func (*Linstor) AccessibleTopologies ¶ added in v0.8.0
func (s *Linstor) AccessibleTopologies(ctx context.Context, volId string, params *volume.Parameters) ([]*csi.Topology, error)
AccessibleTopologies returns a list of pointers to csi.Topology from where the volume is reachable, based on the localStoragePolicy reported by the volume.
func (*Linstor) AllocationSizeKiB ¶ added in v0.3.0
AllocationSizeKiB returns LINSTOR's smallest possible number of KiB that can satisfy the requiredBytes.
func (*Linstor) CapacityBytes ¶ added in v0.8.0
func (s *Linstor) CapacityBytes(ctx context.Context, storagePool string, segments map[string]string) (int64, error)
CapacityBytes returns the amount of free space in the storage pool specified by the params and topology.
func (*Linstor) CompatibleSnapshotId ¶ added in v0.11.0
func (*Linstor) CompatibleVolumeId ¶ added in v0.16.0
func (*Linstor) ControllerExpand ¶ added in v0.9.0
func (*Linstor) Create ¶
func (s *Linstor) Create(ctx context.Context, vol *volume.Info, params *volume.Parameters, topologies *csi.TopologyRequirement) error
Create creates the resource definition, volume definition, and assigns the resulting resource to LINSTOR nodes.
func (*Linstor) Delete ¶
Delete removes a persistent volume from LINSTOR.
In order to support Snapshots living longer than their volumes, we have to keep the resource definition around while the actual resources are gone. An elegant way to go about this is by simply deleting the volume definition. This hides
func (*Linstor) FindAssignmentOnNode ¶ added in v0.16.0
func (s *Linstor) FindAssignmentOnNode(ctx context.Context, volId, node string) (*volume.Assignment, error)
FindAssignmentOnNode returns a pointer to a volume.Assignment for a given node.
func (*Linstor) FindByID ¶ added in v0.10.2
FindByID retrieves a volume.Info that has an id that matches the CSI volume id. Matches the LINSTOR resource name.
func (*Linstor) FindSnapByID ¶ added in v0.11.0
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
func (*Linstor) FindSnapsBySource ¶ added in v0.11.0
func (*Linstor) GetLegacyVolumeParameters ¶ added in v0.16.0
func (*Linstor) GetNodeTopologies ¶ added in v0.10.0
func (*Linstor) GetVolumeStats ¶ added in v0.8.0
func (s *Linstor) GetVolumeStats(path string) (volume.VolumeStats, error)
GetVolumeStats determines filesystem usage.
func (*Linstor) IsNotMountPoint ¶ added in v0.8.0
IsNotMountPoint determines if a directory is a mountpoint.
Non-existent paths return (true, nil).
func (*Linstor) ListAll ¶
ListAll returns a sorted list of pointers to volume.Info. Only the LINSTOR volumes that can be serialized into a volume.Info are included.
func (*Linstor) ListSnaps ¶ added in v0.8.0
ListSnaps returns list of snapshots available in the cluster, including those available in remote (S3) locations
func (*Linstor) Mount ¶
func (s *Linstor) Mount(ctx context.Context, source, target, fsType string, readonly bool, mntOpts []string) error
Mount makes volumes consumable from the source to the target. Filesystems are formatted and block devices are bind mounted. Operates locally on the machines where it is called.
func (*Linstor) NodeAvailable ¶
NodeAvailable makes sure that LINSTOR considers that the node is in an ONLINE state.
func (*Linstor) NodeExpand ¶ added in v0.9.0
func (*Linstor) SnapCreate ¶ added in v0.8.0
func (s *Linstor) SnapCreate(ctx context.Context, id, sourceVolId string, params *volume.SnapshotParameters) (*csi.Snapshot, error)
SnapCreate calls LINSTOR to create a new snapshot name "id" or backup of the volume "sourceVolId".
func (*Linstor) SnapDelete ¶ added in v0.8.0
SnapDelete calls LINSTOR to delete the snapshot based on the CSI Snapshot ID.
func (*Linstor) SortByPreferred ¶ added in v0.19.0
func (s *Linstor) SortByPreferred(ctx context.Context, nodes []string, remotePolicy volume.RemoteAccessPolicy, preferred []*csi.Topology) ([]string, error)
SortByPreferred sorts nodes based on the given topology preferences.
The resulting list of nodes contains the same nodes as in the input, but sorted by the preferred topologies. A node matching the first preferred topology will be first in the output, after that nodes that match the first preferred topology via volume.RemoteAccessPolicy, after that nodes for the second preferred topology, until at the end all nodes that don't match any preferred topology are listed.
func (*Linstor) Unmount ¶
Unmount unmounts the target. Operates locally on the machines where it is called.
func (*Linstor) VolFromSnap ¶ added in v0.8.0
func (s *Linstor) VolFromSnap(ctx context.Context, snap *csi.Snapshot, vol *volume.Info, params *volume.Parameters, topologies *csi.TopologyRequirement) error
VolFromSnap creates the volume using the data contained within the snapshot.
type MockStorage ¶
type MockStorage struct {
// contains filtered or unexported fields
}
func NewMockStorage ¶ added in v0.16.0
func NewMockStorage() *MockStorage
func (*MockStorage) AccessibleTopologies ¶ added in v0.8.0
func (s *MockStorage) AccessibleTopologies(ctx context.Context, volId string, params *volume.Parameters) ([]*csi.Topology, error)
func (*MockStorage) AllocationSizeKiB ¶ added in v0.3.0
func (s *MockStorage) AllocationSizeKiB(requiredBytes, limitBytes int64) (int64, error)
func (*MockStorage) CapacityBytes ¶ added in v0.8.0
func (*MockStorage) CompatibleSnapshotId ¶ added in v0.11.0
func (s *MockStorage) CompatibleSnapshotId(name string) string
func (*MockStorage) CompatibleVolumeId ¶ added in v0.16.0
func (s *MockStorage) CompatibleVolumeId(name, pvcNamespace, pvcName string) string
func (*MockStorage) ControllerExpand ¶ added in v0.9.0
func (*MockStorage) Create ¶
func (s *MockStorage) Create(ctx context.Context, vol *volume.Info, params *volume.Parameters, topologies *csi.TopologyRequirement) error
func (*MockStorage) Detach ¶
func (s *MockStorage) Detach(ctx context.Context, volId, node string) error
func (*MockStorage) FindAssignmentOnNode ¶ added in v0.16.0
func (s *MockStorage) FindAssignmentOnNode(ctx context.Context, volId, node string) (*volume.Assignment, error)
func (*MockStorage) FindSnapByID ¶ added in v0.11.0
func (*MockStorage) FindSnapsBySource ¶ added in v0.11.0
func (*MockStorage) GetLegacyVolumeParameters ¶ added in v0.16.0
func (s *MockStorage) GetLegacyVolumeParameters(ctx context.Context, volId string) (*volume.Parameters, error)
func (*MockStorage) GetNodeTopologies ¶ added in v0.10.0
func (*MockStorage) GetVolumeStats ¶ added in v0.8.0
func (s *MockStorage) GetVolumeStats(path string) (volume.VolumeStats, error)
func (*MockStorage) IsNotMountPoint ¶ added in v0.8.0
func (s *MockStorage) IsNotMountPoint(target string) (bool, error)
func (*MockStorage) NodeAvailable ¶
func (s *MockStorage) NodeAvailable(ctx context.Context, node string) error
func (*MockStorage) NodeExpand ¶ added in v0.9.0
func (s *MockStorage) NodeExpand(source, target string) error
func (*MockStorage) SnapCreate ¶ added in v0.8.0
func (s *MockStorage) SnapCreate(ctx context.Context, id, sourceVolId string, params *volume.SnapshotParameters) (*csi.Snapshot, error)
func (*MockStorage) SnapDelete ¶ added in v0.8.0
func (*MockStorage) Status ¶ added in v0.20.0
func (s *MockStorage) Status(ctx context.Context, volId string) ([]string, *csi.VolumeCondition, error)
func (*MockStorage) Unmount ¶
func (s *MockStorage) Unmount(target string) error
func (*MockStorage) VolFromSnap ¶ added in v0.8.0
func (s *MockStorage) VolFromSnap(ctx context.Context, snap *csi.Snapshot, vol *volume.Info, parameters *volume.Parameters, topologies *csi.TopologyRequirement) error