client

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

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 LabelBySP added in v0.21.0

func LabelBySP(b bool) func(*Linstor) error

func LogFmt added in v0.8.0

func LogFmt(fmt logrus.Formatter) func(*Linstor) error

LogFmt sets the format of the log outpout via the provided logrus.Formatter.

func LogLevel added in v0.8.0

func LogLevel(s string) func(*Linstor) error

LogLevel sets the logging intensity. Debug additionally reports the function from which the logger was called.

func LogOut added in v0.8.0

func LogOut(out io.Writer) func(*Linstor) error

LogOut sets the Linstor client to write logs to the provided io.Writer instead of discarding logs.

func NodesAndConditionFromResources added in v1.2.3

func NodesAndConditionFromResources(ress []lapi.Resource) ([]string, *csi.VolumeCondition)

func PropertyNamespace added in v0.21.0

func PropertyNamespace(ns string) func(*Linstor) error

Types

type BackupWithRemote added in v1.2.0

type BackupWithRemote struct {
	lapi.Backup
	Remote string
}

type DeleteInProgressError added in v0.13.1

type DeleteInProgressError struct {
	Kind      string
	Name      string
	Operation string
}

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

func NewLinstor(options ...func(*Linstor) error) (*Linstor, error)

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

func (s *Linstor) AllocationSizeKiB(requiredBytes, limitBytes int64) (int64, error)

AllocationSizeKiB returns LINSTOR's smallest possible number of KiB that can satisfy the requiredBytes.

func (*Linstor) Attach

func (s *Linstor) Attach(ctx context.Context, volId, node string, rwxBlock bool) error

Attach idempotently creates a resource on the given node.

func (*Linstor) CapacityBytes added in v0.8.0

func (s *Linstor) CapacityBytes(ctx context.Context, storagePools []string, overProvision *float64, 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 (s *Linstor) CompatibleSnapshotId(name string) string

func (*Linstor) CompatibleVolumeId added in v0.16.0

func (s *Linstor) CompatibleVolumeId(name, pvcNamespace, pvcName string) string

func (*Linstor) ControllerExpand added in v0.9.0

func (s *Linstor) ControllerExpand(ctx context.Context, vol *volume.Info) error

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

func (s *Linstor) Delete(ctx context.Context, volId string) error

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) DeleteTemporarySnapshotID added in v1.6.0

func (s *Linstor) DeleteTemporarySnapshotID(ctx context.Context, id string) error

func (*Linstor) Detach

func (s *Linstor) Detach(ctx context.Context, volId, node string) error

Detach removes a volume from the node.

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

func (s *Linstor) FindByID(ctx context.Context, id string) (*volume.Info, error)

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

func (s *Linstor) FindSnapByID(ctx context.Context, id string) (*volume.Snapshot, bool, 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

func (*Linstor) FindSnapsBySource added in v0.11.0

func (s *Linstor) FindSnapsBySource(ctx context.Context, sourceVol *volume.Info, start, limit int) ([]*volume.Snapshot, error)

func (*Linstor) GetLegacyVolumeParameters added in v0.16.0

func (s *Linstor) GetLegacyVolumeParameters(ctx context.Context, volId string) (*volume.Parameters, error)

func (*Linstor) GetNodeTopologies added in v0.10.0

func (s *Linstor) GetNodeTopologies(ctx context.Context, nodename string) (*csi.Topology, error)

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

func (s *Linstor) IsNotMountPoint(target string) (bool, error)

IsNotMountPoint determines if a directory is a mountpoint.

Non-existent paths return (true, nil).

func (*Linstor) ListAllWithStatus added in v1.2.3

func (s *Linstor) ListAllWithStatus(ctx context.Context) ([]volume.VolumeStatus, error)

ListAllWithStatus returns a sorted list of volume and their status.

func (*Linstor) ListSnaps added in v0.8.0

func (s *Linstor) ListSnaps(ctx context.Context, start, limit int) ([]*volume.Snapshot, error)

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

func (s *Linstor) NodeAvailable(ctx context.Context, node string) error

NodeAvailable makes sure that LINSTOR considers that the node is in an ONLINE state.

func (*Linstor) NodeExpand added in v0.9.0

func (s *Linstor) NodeExpand(source, target string) error

func (*Linstor) SnapCreate added in v0.8.0

func (s *Linstor) SnapCreate(ctx context.Context, id, sourceVolId string, params *volume.SnapshotParameters) (*volume.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

func (s *Linstor) SnapDelete(ctx context.Context, snap *volume.Snapshot) error

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) Status added in v0.20.0

func (s *Linstor) Status(ctx context.Context, volId string) ([]string, *csi.VolumeCondition, error)

func (*Linstor) Unmount

func (s *Linstor) Unmount(target string) error

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 *volume.Snapshot, vol *volume.Info, params *volume.Parameters, snapParams *volume.SnapshotParameters, 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) Attach

func (s *MockStorage) Attach(ctx context.Context, volId, node string, rwxBlock bool) error

func (*MockStorage) CapacityBytes added in v0.8.0

func (s *MockStorage) CapacityBytes(ctx context.Context, pools []string, overProvision *float64, segments map[string]string) (int64, error)

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 (s *MockStorage) ControllerExpand(ctx context.Context, vol *volume.Info) error

func (*MockStorage) Create

func (s *MockStorage) Create(ctx context.Context, vol *volume.Info, params *volume.Parameters, topologies *csi.TopologyRequirement) error

func (*MockStorage) Delete

func (s *MockStorage) Delete(ctx context.Context, volId string) error

func (*MockStorage) DeleteTemporarySnapshotID added in v1.6.0

func (s *MockStorage) DeleteTemporarySnapshotID(ctx context.Context, id string) 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) FindByID added in v0.10.2

func (s *MockStorage) FindByID(ctx context.Context, id string) (*volume.Info, error)

func (*MockStorage) FindSnapByID added in v0.11.0

func (s *MockStorage) FindSnapByID(ctx context.Context, id string) (*volume.Snapshot, bool, error)

func (*MockStorage) FindSnapsBySource added in v0.11.0

func (s *MockStorage) FindSnapsBySource(ctx context.Context, sourceVol *volume.Info, start, limit int) ([]*volume.Snapshot, error)

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 (s *MockStorage) GetNodeTopologies(_ context.Context, node string) (*csi.Topology, error)

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) ListAllWithStatus added in v1.2.3

func (s *MockStorage) ListAllWithStatus(ctx context.Context) ([]volume.VolumeStatus, error)

func (*MockStorage) ListSnaps added in v0.8.0

func (s *MockStorage) ListSnaps(ctx context.Context, start, limit int) ([]*volume.Snapshot, error)

func (*MockStorage) Mount

func (s *MockStorage) Mount(ctx context.Context, source, target, fsType string, readonly bool, mntOpts []string) 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) (*volume.Snapshot, error)

func (*MockStorage) SnapDelete added in v0.8.0

func (s *MockStorage) SnapDelete(ctx context.Context, snap *volume.Snapshot) error

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 *volume.Snapshot, vol *volume.Info, parameters *volume.Parameters, snapParams *volume.SnapshotParameters, topologies *csi.TopologyRequirement) error

func (*MockStorage) VolFromVol added in v0.8.0

func (s *MockStorage) VolFromVol(ctx context.Context, sourceVol, vol *volume.Info) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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