driver

package
v0.0.0-...-5fd007c Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2024 License: Apache-2.0 Imports: 42 Imported by: 0

Documentation

Overview

Copyright (C) 2022 metal-stack and scaleway authors SPDX-License-Identifier: Apache-2.0

Index

Constants

View Source
const (
	KiB int64 = 1024
	MiB int64 = 1024 * KiB
	GiB int64 = 1024 * MiB
	TiB int64 = 1024 * GiB
	PiB int64 = 1024 * TiB
)
View Source
const (
	Ext4FS = "ext4" // default
	XfsFS  = "xfs"
)
View Source
const (
	DefaultLUKSCfgFileName = "luks_config.yaml"
)

Variables

This section is empty.

Functions

func ConstructMountOptions

func ConstructMountOptions(mountOptions []string, volCap *csi.VolumeCapability) []string

ConstructMountOptions returns only unique mount options in slice.

func GetFullVersionStr

func GetFullVersionStr() string

func GetVersion

func GetVersion() string

func IsMountPoint

func IsMountPoint(p string) (bool, error)

IsMountPoint checks if the given path is mountpoint or not.

func IsVolumeReadOnly

func IsVolumeReadOnly(capability *csi.VolumeCapability) bool

IsVolumeReadOnly checks the access mode in Volume Capability and decides if volume is readonly or not.

func MakeFile

func MakeFile(path string) error

Types

type Config

type Config struct {
	DefaultBackend string
	BackendCfgPath string // if valid - contents override DefaultBackend.
	JWTPath        string
	LUKSCfgPath    string

	NodeID   string
	Endpoint string // must be a Unix Domain Socket URI

	DefaultFS string // one of: ext4, xfs

	LogLevel      string // one of: debug/info/warn/error
	LogRole       string
	LogTimestamps bool
	LogFormat     string

	// hidden, dev-only options:
	BinaryName    string
	Transport     string // one of: tcp/rdma
	SquelchPanics bool
	PrettyJSON    bool
	RWX           bool
}

type Driver

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

func New

func New(cfg Config) (*Driver, error)

func (*Driver) ControllerExpandVolume

func (d *Driver) ControllerExpandVolume(
	ctx context.Context, req *csi.ControllerExpandVolumeRequest,
) (*csi.ControllerExpandVolumeResponse, error)

func (*Driver) ControllerGetVolume

func (*Driver) ControllerPublishVolume

func (*Driver) CreateSnapshot

func (d *Driver) CreateSnapshot(
	ctx context.Context, req *csi.CreateSnapshotRequest,
) (*csi.CreateSnapshotResponse, error)

func (*Driver) CreateVolume

func (d *Driver) CreateVolume(
	ctx context.Context, req *csi.CreateVolumeRequest,
) (*csi.CreateVolumeResponse, error)

CreateVolume uses info extracted from request `parameters` field to connect to LB and attempt to create the volume specified by `name` field (or return info on an existing volume if one matches, for idempotency). see `lbCreateVolumeParams` for more details on the format.

TODO: on volume "clone" ops, the CSI spec seems to require that the plugin detect "incompatibility between `parameters` from the source and the ones requested for the new volume". unfortunately, the CSI spec does NOT supply the `parameters` of the source as part of the params to this call. it is unspecified how the plugin is supposed to pull this off.

TODO: it's also unclear what's the expected behaviour if a "clone" op is requested for a FS volume with a block mode vol or snap specified as a source. since the capabilities of the source volume are not passed in to this call either, how are plugins expected to detect such cases?

func (*Driver) DeleteSnapshot

func (d *Driver) DeleteSnapshot(
	ctx context.Context, req *csi.DeleteSnapshotRequest,
) (*csi.DeleteSnapshotResponse, error)

func (*Driver) DeleteVolume

func (d *Driver) DeleteVolume(
	ctx context.Context, req *csi.DeleteVolumeRequest,
) (*csi.DeleteVolumeResponse, error)

func (*Driver) GetCapacity

func (d *Driver) GetCapacity(
	ctx context.Context, req *csi.GetCapacityRequest,
) (*csi.GetCapacityResponse, error)

func (*Driver) GetLBClient

func (d *Driver) GetLBClient(
	ctx context.Context, mgmtEPs endpoint.Slice, mgmtScheme string,
) (lb.Client, error)

GetLBClient conjures up a functional LB mgmt API client by whatever means necessary. the errors it returns are gRPC-grade and can be returned directly to the remote CSI API clients.

func (*Driver) GetPluginInfo

func (*Driver) ListSnapshots

func (*Driver) ListVolumes

func (*Driver) NodeExpandVolume

func (d *Driver) NodeExpandVolume(
	_ context.Context, req *csi.NodeExpandVolumeRequest,
) (*csi.NodeExpandVolumeResponse, error)

func (*Driver) NodeGetCapabilities

func (*Driver) NodeGetInfo

func (*Driver) NodeGetVolumeStats

func (d *Driver) NodeGetVolumeStats(
	ctx context.Context, req *csi.NodeGetVolumeStatsRequest,
) (*csi.NodeGetVolumeStatsResponse, error)

func (*Driver) NodePublishVolume

func (d *Driver) NodePublishVolume(
	ctx context.Context, req *csi.NodePublishVolumeRequest,
) (*csi.NodePublishVolumeResponse, error)

TODO: see the wonderful mandated error codes table covering NodePublishVolume return value semantics... (NOT currently implemented that way!)

func (*Driver) NodeStageVolume

func (d *Driver) NodeStageVolume(
	ctx context.Context, req *csi.NodeStageVolumeRequest,
) (*csi.NodeStageVolumeResponse, error)

NodeStageVolume obtains the necessary NVMe-oF target(s) endpoints from the LB mgmt API server(s) specified in `NodeStageVolumeRequest.volume_id`, then establishes data plane connections to them to attach the volume to the node. it will also format the volume with a specified FS, if necessary, or try to recover the FS (q.v. fsck) if an existing one is detected.

func (*Driver) NodeUnpublishVolume

func (*Driver) NodeUnstageVolume

func (d *Driver) NodeUnstageVolume(
	ctx context.Context, req *csi.NodeUnstageVolumeRequest,
) (*csi.NodeUnstageVolumeResponse, error)

func (*Driver) Probe

func (d *Driver) Probe(
	_ context.Context, _ *csi.ProbeRequest,
) (*csi.ProbeResponse, error)

func (*Driver) PutLBClient

func (d *Driver) PutLBClient(clnt lb.Client)

PutLBClient returns a client that necessarily must have been previously obtained using GetLBClient, with the understanding that the Driver will dispose of it as necessary at its discretion.

func (*Driver) Run

func (d *Driver) Run() error

Directories

Path Synopsis
dsc

Jump to

Keyboard shortcuts

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