client

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: 33 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 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.

Types

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, vol *volume.Info) ([]*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, vol *volume.Info, node string) 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, parameters, 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) 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, req *csi.CreateVolumeRequest) 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, vol *volume.Info) error

Delete removes a resource, all of its volumes from LINSTOR. Only removes the ResourceDefinition if no snapshots of the resource exist.

func (*Linstor) Detach

func (s *Linstor) Detach(ctx context.Context, vol *volume.Info, node string) error

Detach removes a volume from the node.

func (*Linstor) FindByID added in v0.10.2

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

FindByID retrives a volume.Info that has an id that matches the CSI volume id. Matches the LINSTOR resource name.

func (*Linstor) FindByName added in v0.10.2

func (s *Linstor) FindByName(ctx context.Context, name string) (*volume.Info, error)

FindByID retrives a volume.Info that has a name that matches the CSI volume Name, not nessesarily the LINSTOR resource name or UUID.

func (*Linstor) FindSnapByID added in v0.11.0

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

func (*Linstor) FindSnapsBySource added in v0.11.0

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

func (*Linstor) GetAssignmentOnNode

func (s *Linstor) GetAssignmentOnNode(ctx context.Context, vol *volume.Info, node string) (*volume.Assignment, error)

GetAssignmentOnNode returns a pointer to a volume.Assignment for a given node.

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) ListAll

func (s *Linstor) ListAll(ctx context.Context) ([]*volume.Info, error)

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

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

ListSnaps returns list of pointers to volume.SnapInfo based off of the serialized snapshot info stored in resource definitions.

func (*Linstor) Mount

func (s *Linstor) Mount(ctx context.Context, vol *volume.Info, source, target, fsType string, readonly bool, options []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 string, sourceVol *volume.Info) (*csi.Snapshot, error)

SnapCreate calls linstor to create a new snapshot on the volume indicated by the SourceVolumeId contained in the CSI Snapshot.

func (*Linstor) SnapDelete added in v0.8.0

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

SnapDelete calls LINSTOR to delete the snapshot based on the CSI Snapshot ID.

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 *csi.Snapshot, vol *volume.Info) error

VolFromSnap creates the volume using the data contained within the snapshot.

type MockStorage

type MockStorage struct {
	// contains filtered or unexported fields
}

func (*MockStorage) AccessibleTopologies added in v0.8.0

func (s *MockStorage) AccessibleTopologies(ctx context.Context, vol *volume.Info) ([]*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, vol *volume.Info, node string) error

func (*MockStorage) CapacityBytes added in v0.8.0

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

func (*MockStorage) CompatibleSnapshotId added in v0.11.0

func (s *MockStorage) CompatibleSnapshotId(name 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, req *csi.CreateVolumeRequest) error

func (*MockStorage) Delete

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

func (*MockStorage) Detach

func (s *MockStorage) Detach(ctx context.Context, vol *volume.Info, node string) error

func (*MockStorage) FindByID added in v0.10.2

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

func (*MockStorage) FindByName added in v0.10.2

func (s *MockStorage) FindByName(ctx context.Context, name string) (*volume.Info, error)

func (*MockStorage) FindSnapByID added in v0.11.0

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

func (*MockStorage) FindSnapsBySource added in v0.11.0

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

func (*MockStorage) GetAssignmentOnNode

func (s *MockStorage) GetAssignmentOnNode(ctx context.Context, vol *volume.Info, node string) (*volume.Assignment, 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) ListAll

func (s *MockStorage) ListAll(ctx context.Context) ([]*volume.Info, error)

func (*MockStorage) ListSnaps added in v0.8.0

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

func (*MockStorage) Mount

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

func (*MockStorage) SnapDelete added in v0.8.0

func (s *MockStorage) SnapDelete(ctx context.Context, snap *csi.Snapshot) 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) 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