csirsd

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

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

Go to latest
Published: Nov 20, 2019 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KB = 1 << (10 * iota)
	MB
	GB
	TB
)

Size constants (Kilobytes, Megabytes, etc)

View Source
const (
	// DriverName defines the name that is used in Kubernetes and the CSI
	// system for the canonical, official name of this plugin
	DriverName = "csi.rsd.intel.com"

	// DriverVersion defines current CSI Driver version
	DriverVersion = "0.0.1"

	// PublishInfoVolumeName is used to pass the volume name from
	// `ControllerPublishVolume` to `NodeStageVolume or `NodePublishVolume`
	PublishInfoVolumeName = DriverName + "/volume-name"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ControllerInfo

type ControllerInfo struct {
	Subnqn string `json:"subnqn"`
}

ControllerInfo declares only SubNQN as it's the only attribute we use

type DeviceList

type DeviceList struct {
	Devices []struct {
		DevicePath string `json:"DevicePath"`
	} `json:"Devices"`
}

DeviceList declares list of NVME device paths

type Driver

type Driver struct {
	sync.Mutex

	RSDNodeID string
	// contains filtered or unexported fields
}

Driver implements the following CSI interfaces:

csi.IdentityServer
csi.ControllerServer
csi.NodeServer

func NewDriver

func NewDriver(ep string, RSDNodeID string, rsdClient rsd.Transport) *Driver

NewDriver returns a CSI plugin that contains the necessary gRPC interfaces to interact with Kubernetes over unix domain socket

func (*Driver) ControllerGetCapabilities

ControllerGetCapabilities returns the capabilities of the controller service.

func (*Driver) ControllerPublishVolume

ControllerPublishVolume attaches the given volume to the node

func (*Driver) ControllerUnpublishVolume

ControllerUnpublishVolume deattaches the given volume from the node

func (*Driver) CreateSnapshot

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

CreateSnapshot creates new volume snapshot

func (*Driver) CreateVolume

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

CreateVolume creates new RSD Volume

func (*Driver) DeleteSnapshot

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

DeleteSnapshot deletes volume snapshot

func (*Driver) DeleteVolume

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

DeleteVolume deletes existing RSD Volume

func (*Driver) GetCapacity

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

GetCapacity returns the capacity of the storage

func (*Driver) GetPluginCapabilities

GetPluginCapabilities returns available capabilities of the plugin

func (*Driver) GetPluginInfo

func (drv *Driver) GetPluginInfo(ctx context.Context, req *csi.GetPluginInfoRequest) (*csi.GetPluginInfoResponse, error)

GetPluginInfo returns metadata of the plugin

func (*Driver) ListSnapshots

func (drv *Driver) ListSnapshots(ctx context.Context, req *csi.ListSnapshotsRequest) (*csi.ListSnapshotsResponse, error)

ListSnapshots returns a list of requested volume snapshots

func (*Driver) ListVolumes

func (drv *Driver) ListVolumes(ctx context.Context, req *csi.ListVolumesRequest) (*csi.ListVolumesResponse, error)

ListVolumes returns a list of available volumes created by the driver

func (*Driver) NodeGetCapabilities

func (drv *Driver) NodeGetCapabilities(ctx context.Context, req *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error)

NodeGetCapabilities returns the supported capabilities of the node server

func (*Driver) NodeGetInfo

func (drv *Driver) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error)

NodeGetInfo returns the supported capabilities of the node server. This is used so the CO knows where to place the workload. The result of this function will be used by the CO in ControllerPublishVolume.

func (*Driver) NodeGetVolumeStats

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

NodeGetVolumeStats returns the volume capacity statistics available for the given volume.

func (*Driver) NodePublishVolume

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

NodePublishVolume mounts the volume mounted to the staging path to the target path

func (*Driver) NodeStageVolume

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

NodeStageVolume mounts the volume to a staging path on the node. This is called by the CO before NodePublishVolume and is used to temporary mount the volume to a staging path. Once mounted, NodePublishVolume will make sure to bindmount it to the appropriate path

func (*Driver) NodeUnpublishVolume

func (drv *Driver) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error)

NodeUnpublishVolume unmounts the volume from the target path

func (*Driver) NodeUnstageVolume

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

NodeUnstageVolume unstages the volume from the staging path

func (*Driver) Probe

func (drv *Driver) Probe(ctx context.Context, req *csi.ProbeRequest) (*csi.ProbeResponse, error)

Probe returns the health and readiness of the plugin

func (*Driver) Run

func (drv *Driver) Run() error

Run starts the CSI plugin by communication over the given endpoint

func (*Driver) ValidateVolumeCapabilities

ValidateVolumeCapabilities checks if requested volume capabilities are supported

type Mounter

type Mounter interface {
	// Mount mounts source to target as fstype with given options.
	Mount(source string, target string, fstype string, opts ...string) error
	// Unmount unmounts given target.
	Unmount(target string) error
	/// IsMounted checks whether the source device is mounted to the target
	// path. Source can be empty. In that case it only checks whether the
	// device is mounted or not.
	// It returns true if it's mounted.
	IsMounted(source, target string) (bool, error)
	// IsFormatted checks whether the source device is formatted or not. It
	// returns true if the source device is already formatted.
	IsFormatted(source string) (bool, error)
	// Format formats the source with the given filesystem type
	Format(source, fsType string) error
}

Mounter interface declares volume mounting and formatting operations

type NVMe

type NVMe interface {
	// Connect to NVMe subsystem
	Connect(transport, traddr, traddrfamily, trsvcid, nqn, hostnqn string) (string, error)
	// Disconnect from NVMe subystem
	Disconnect(device string) error
}

NVMe interface declares NVMe operations required by the RSD CSI driver

type Volume

type Volume struct {
	Name              string
	CSIVolume         *csi.Volume
	RSDVolume         *rsd.Volume
	EndPoint          *endPointInfo
	RSDNodeID         string
	RSDNodeNQN        string
	Device            string
	IsPublished       bool
	IsStaged          bool
	StagingTargetPath string
	TargetPaths       map[string]bool
}

Volume contains mapping between CSI and RSD volumes and internal driver information about a volume status

Jump to

Keyboard shortcuts

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