driver

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2024 License: MPL-2.0 Imports: 53 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCSIEndpoint                       = "unix://tmp/csi.sock"
	DefaultModifyVolumeRequestHandlerTimeout = 30 * ltime.Second
	AgentNotReadyNodeTaintKey                = "csi.vngcloud.vn/agent-not-ready"

	DefaultTimeoutModifyChannel = 10 * ltime.Minute

	DriverName      = "bs.csi.vngcloud.vn"
	ZoneTopologyKey = "topology." + DriverName + "/zone"
)
View Source
const (
	// FSTypeExt2 represents the ext2 filesystem type
	FSTypeExt2 = "ext2"
	// FSTypeExt3 represents the ext3 filesystem type
	FSTypeExt3 = "ext3"
	// FSTypeExt4 represents the ext4 filesystem type
	FSTypeExt4 = "ext4"
	// FSTypeXfs represents the xfs filesystem type
	FSTypeXfs = "xfs"
	// FSTypeNtfs represents the ntfs filesystem type
	FSTypeNtfs = "ntfs"
)

constants for fstypes

View Source
const (
	// VolumeTypeKey represents key for volume type
	VolumeTypeKey = "type"

	// EncryptedKey represents key for whether filesystem is encrypted
	EncryptedKey = "encrypted"

	// PVCNameKey contains name of the PVC for which is a volume provisioned.
	PVCNameKey = "csi.storage.k8s.io/pvc/name"

	// PVCNamespaceKey contains namespace of the PVC for which is a volume provisioned.
	PVCNamespaceKey = "csi.storage.k8s.io/pvc/namespace"

	// PVNameKey contains name of the final PV that will be used for the dynamically provisioned volume
	PVNameKey = "csi.storage.k8s.io/pv/name"

	// BlockSizeKey configures the block size when formatting a volume
	BlockSizeKey = "blocksize"

	// InodeSizeKey configures the inode size when formatting a volume
	InodeSizeKey = "inodesize"

	// BytesPerInodeKey configures the `bytes-per-inode` when formatting a volume
	BytesPerInodeKey = "bytesperinode"

	// NumberOfInodesKey configures the `number-of-inodes` when formatting a volume
	NumberOfInodesKey = "numberofinodes"

	// Ext4BigAllocKey enables the bigalloc option when formatting an ext4 volume
	Ext4BigAllocKey = "ext4bigalloc"

	// Ext4ClusterSizeKey configures the cluster size when formatting an ext4 volume with the bigalloc option enabled
	Ext4ClusterSizeKey = "ext4clustersize"

	// IsPoc is a key to determine if the volume is a POC volume
	IsPoc = "ispoc"

	AnnotationModificationKeyVolumeType = "volume-type"
)

constants of keys in volume parameters

View Source
const (
	// DevicePathKey represents key for device path in PublishContext, devicePath is the device path where the volume is attached to
	DevicePathKey = "devicePath"

	// VolumeAttributePartition represents key for partition config in VolumeContext
	// this represents the partition number on a device used to mount
	VolumeAttributePartition = "partition"
)

Supported access modes

Variables

View Source
var (
	// NewMetadataFunc is a variable for the cloud.NewMetadata function that can
	// be overwritten in unit tests.
	NewMetadataFunc = lscloud.NewMetadataService
	NewCloudFunc    = lscloud.NewCloud
)
View Source
var (
	ErrVolumeNameNotProvided           = lstt.Error(lcodes.InvalidArgument, "Volume name not provided")
	ErrVolumeCapabilitiesNotProvided   = lstt.Error(lcodes.InvalidArgument, "Volume capabilities not provided")
	ErrVolumeCapabilitiesNotSupported  = lstt.Error(lcodes.InvalidArgument, "Volume capabilities not supported")
	ErrCapacityRangeNotProvided        = lstt.Error(lcodes.InvalidArgument, "Capacity range is required")
	ErrModifyMutableParam              = lstt.Error(lcodes.InvalidArgument, "Invalid mutable parameters")
	ErrVolumeIDNotProvided             = lstt.Error(lcodes.InvalidArgument, "Volume ID not provided")
	ErrNodeIdNotProvided               = lstt.Error(lcodes.InvalidArgument, "Node ID not provided")
	ErrStagingTargetPathNotProvided    = lstt.Error(lcodes.InvalidArgument, "Staging target not provided")
	ErrVolumeContentSourceNotSupported = lstt.Error(lcodes.InvalidArgument, "Unsupported volumeContentSource type")
	ErrSnapshotIsNil                   = lstt.Error(lcodes.InvalidArgument, "Error retrieving snapshot from the volumeContentSource")
	ErrSnapshotNameNotProvided         = lstt.Error(lcodes.InvalidArgument, "Snapshot name not provided")
	ErrSnapshotSourceVolumeNotProvided = lstt.Error(lcodes.InvalidArgument, "Snapshot volume source ID not provided")
	ErrVolumeAttributesInvalid         = lstt.Error(lcodes.InvalidArgument, "Volume attributes are invalid")
	ErrMountIsNil                      = lstt.Error(lcodes.InvalidArgument, "Mount is nil within volume capability")
	ErrDevicePathNotProvided           = lstt.Error(lcodes.InvalidArgument, "Device path not provided")
	ErrStagingTargetNotProvided        = lstt.Error(lcodes.InvalidArgument, "Staging target not provided")
	ErrTargetPathNotProvided           = lstt.Error(lcodes.InvalidArgument, "Target path not provided")
	ErrVolumeCapabilityNotProvided     = lstt.Error(lcodes.InvalidArgument, "Volume capability not provided")
	ErrVolumeCapabilityNotSupported    = lstt.Error(lcodes.InvalidArgument, "Volume capability not supported")
	ErrVolumePathNotProvided           = lstt.Error(lcodes.InvalidArgument, "Volume path not provided")

	ErrInvalidFstype = func(pfstype string) error {
		return lstt.Errorf(lcodes.InvalidArgument, "Invalid fstype (%s)", pfstype)
	}

	ErrCanNotParseRequestArguments = func(pargument, pvalue string) error {
		return lstt.Errorf(lcodes.InvalidArgument, "Could not parse %s (%s)", pargument, pvalue)
	}

	ErrInvalidFormatParameter = func(pkey string, perr error) error {
		return lstt.Errorf(lcodes.InvalidArgument, "Invalid %s (aborting!): %v", pkey, perr)
	}

	ErrCanNotUseSpecifiedFstype = func(pkey, pfsType string) error {
		return lstt.Errorf(lcodes.InvalidArgument, "Cannot use %s with fstype %s", pkey, pfsType)
	}
)
View Source
var (
	ErrVolumeIsCreating = func(pvolumeID string) error {
		return lstt.Errorf(lcodes.Aborted, "Create volume request for %s is already in progress", pvolumeID)
	}

	ErrOperationAlreadyExists = func(pvolumeID string) error {
		return lstt.Errorf(lcodes.Aborted, "An operation with the given volume %s already exists", pvolumeID)
	}

	ErrSnapshotIsDeleting = func(psnapshotID string) error {
		return lstt.Errorf(lcodes.Aborted, "Delete snapshot request for %s is already in progress", psnapshotID)
	}
)
View Source
var (
	ErrAttachVolume = func(pvolumeID, pnodeID string) error {
		return lstt.Errorf(lcodes.Internal, "CANNOT Attach volume %s to node %s", pvolumeID, pnodeID)
	}

	ErrDetachVolume = func(pvolumeID, pnodeID string) error {
		return lstt.Errorf(lcodes.Internal, "CANNOT Detach volume %s from node %s", pvolumeID, pnodeID)
	}

	ErrFailedToGetDevicePath = func(pvolumeID, pnodeID string) error {
		return lstt.Errorf(lcodes.Internal, "Failed to get device path for volume %s on node %s", pvolumeID, pnodeID)
	}

	ErrFailedToDeleteSnapshot = func(psnapshotID string) error {
		return lstt.Errorf(lcodes.Internal, "CANNOT delete snapshot %s", psnapshotID)
	}

	ErrFailedToListSnapshot = func(pvolumeID string) error {
		return lstt.Errorf(lcodes.Internal, "CANNOT list snapshot for volume %s", pvolumeID)
	}

	ErrDeleteVolumeHavingSnapshots = func(pvolId string) error {
		return lstt.Errorf(lcodes.FailedPrecondition, "Volume %s can not deleted", pvolId)
	}

	ErrFailedToGetVolume = func(pvolumeID string) error {
		return lstt.Errorf(lcodes.Internal, "CANNOT get volume %s", pvolumeID)
	}

	ErrFailedToExpandVolume = func(pvolumeID string, psize int64) error {
		return lstt.Errorf(lcodes.Internal, "CANNOT expand volume %s to new size %d GiB", pvolumeID, psize)
	}

	ErrFailedToModifyVolume = func(pvolumeID string) error {
		return lstt.Errorf(lcodes.Internal, "CANNOT modify volume %s", pvolumeID)
	}

	ErrFailedToDeleteVolume = func(pvolumeID string) error {
		return lstt.Errorf(lcodes.Internal, "CANNOT delete volume %s", pvolumeID)
	}

	ErrFailedToListVolumeByName = func(pvolName string) error {
		return lstt.Errorf(lcodes.Internal, "CANNOT list volume by name %s", pvolName)
	}

	ErrFailedToValidateVolumeSize = func(pvolumeID string, err error) error {
		return lstt.Errorf(lcodes.Internal, "CANNOT validate volume size for volume %s: %w", pvolumeID, err)
	}

	ErrVolumeSizeTooSmall = func(pvolumeID string, psize int64) error {
		return lstt.Errorf(lcodes.InvalidArgument, "Volume size %d is too small for volume %s", psize, pvolumeID)
	}

	ErrFailedToFindTargetPath = func(pdevicePath string, perr error) error {
		return lstt.Errorf(lcodes.Internal, "Failed to find device path %s. %v", pdevicePath, perr)
	}

	ErrFailedToCheckTargetPathExists = func(ptarget string, perr error) error {
		return lstt.Errorf(lcodes.Internal, "Failed to check if target %q exists: %v", ptarget, perr)
	}

	ErrCanNotCreateTargetDir = func(ptarget string, perr error) error {
		return lstt.Errorf(lcodes.Internal, "CAN NOT create target dir %q: %v", ptarget, perr)
	}

	ErrFailedToCheckVolumeMounted = func(perr error) error {
		return lstt.Errorf(lcodes.Internal, "Failed to check if volume is already mounted: %v", perr)
	}

	ErrCanNotFormatAndMountVolume = func(psource, ptarget string, perr error) error {
		return lstt.Errorf(lcodes.Internal, "CAN NOT format %q and mount it at %q: %v", psource, ptarget, perr)
	}

	ErrDetermineVolumeResize = func(pvolumeID, psource string, perr error) error {
		return lstt.Errorf(lcodes.Internal, "Could not determine if volume %q (%q) need to be resized:  %v", pvolumeID, psource, perr)
	}

	ErrAttemptCreateResizeFs = func(perr error) error {
		return lstt.Errorf(lcodes.Internal, "Error attempting to create new ResizeFs:  %v", perr)
	}

	ErrCanNotResizeVolumeOnNode = func(pvolumeID, psource string, perr error) error {
		return lstt.Errorf(lcodes.Internal, "Could not resize volume %q (%q):  %v", pvolumeID, psource, perr)
	}

	ErrFailedCheckTargetPathIsMountPoint = func(ptarget string, perr error) error {
		return lstt.Errorf(lcodes.Internal, "Failed to check if target %q is a mount point: %v", ptarget, perr)
	}

	ErrCanNotUnmountTarget = func(ptarget string, perr error) error {
		return lstt.Errorf(lcodes.Internal, "CAN NOT unmount target %q: %v", ptarget, perr)
	}

	ErrFailedToCheckPathExists = func(ppath string, perr error) error {
		return lstt.Errorf(lcodes.Internal, "Could not check if path exists %q: %v", ppath, perr)
	}

	ErrCanNotRemoveMountTarget = func(ptarget string, perr error) error {
		return lstt.Errorf(lcodes.Internal, "Could not remove mount target %q: %v", ptarget, perr)
	}

	ErrCanNotCreateFile = func(ptarget string, perr error) error {
		return lstt.Errorf(lcodes.Internal, "Could not create file %q: %v", ptarget, perr)
	}

	ErrCheckDiskIsMounted = func(ptarget string, perr error) error {
		return lstt.Errorf(lcodes.Internal, "Could not check if %q is mounted: %v", ptarget, perr)
	}

	ErrCanNotMountAtTarget = func(psource, ptarget string, perr error) error {
		return lstt.Errorf(lcodes.Internal, "Could not mount %q at %q: %v", psource, ptarget, perr)
	}

	ErrUnknownStatsOnPath = func(ppath string, perr error) error {
		return lstt.Errorf(lcodes.Internal, "Unknown error when stat on %s: %v", ppath, perr)
	}

	ErrDeterminedBlockDevice = func(ppath string, perr error) error {
		return lstt.Errorf(lcodes.Internal, "Failed to determine whether %s is block device: %v", ppath, perr)
	}

	ErrCanNotGetBlockCapacity = func(ppath string, perr error) error {
		return lstt.Errorf(lcodes.Internal, "Failed to get block capacity on path %s: %v", ppath, perr)
	}

	ErrFailedToGetFsInfo = func(ppath string, perr error) error {
		return lstt.Errorf(lcodes.Internal, "failed to get fs info on path %s: %v", ppath, perr)
	}
)
View Source
var (
	ErrVolumeNotFound = func(pvolumeID string) error {
		return lstt.Errorf(lcodes.NotFound, "Volume %s not found", pvolumeID)
	}

	ErrPathNotExists = func(ppath string) error {
		return lstt.Errorf(lcodes.NotFound, "path %s does not exist", ppath)
	}
)
View Source
var (
	ErrNotImplemented = func(pfeature string) error {
		return lstt.Errorf(lcodes.Unimplemented, "%s is NOT implemented yet", pfeature)
	}
)
View Source
var (
	ErrRequestExceedLimit = func(pvolSizeBytes, pmaxVolSize int64) error {
		return lstt.Error(lcodes.OutOfRange, lfmt.Sprintf("Requested size %d exceeds limit %d", pvolSizeBytes, pmaxVolSize))
	}
)
View Source
var (
	FileSystemConfigs = map[string]fileSystemConfig{
		FSTypeExt2: {
			NotSupportedParams: map[string]struct{}{
				Ext4BigAllocKey:    {},
				Ext4ClusterSizeKey: {},
			},
		},
		FSTypeExt3: {
			NotSupportedParams: map[string]struct{}{
				Ext4BigAllocKey:    {},
				Ext4ClusterSizeKey: {},
			},
		},
		FSTypeExt4: {
			NotSupportedParams: map[string]struct{}{},
		},
		FSTypeXfs: {
			NotSupportedParams: map[string]struct{}{
				BytesPerInodeKey:   {},
				NumberOfInodesKey:  {},
				Ext4BigAllocKey:    {},
				Ext4ClusterSizeKey: {},
			},
		},
	}
)
View Source
var (
	ValidFSTypes = map[string]struct{}{
		FSTypeExt2: {},
		FSTypeExt3: {},
		FSTypeExt4: {},
		FSTypeXfs:  {},
		FSTypeNtfs: {},
	}
)

Functions

func GetVersionJSON

func GetVersionJSON() (string, error)

func InitOtelTracing

func InitOtelTracing() (*otlptrace.Exporter, error)

func ValidateDriverOptions

func ValidateDriverOptions(options *DriverOptions) error

func WithAlertChannel added in v1.1.1

func WithAlertChannel(alertChannel string) func(*DriverOptions)

func WithAlertChannelSize added in v1.1.1

func WithAlertChannelSize(alertChannelSize int) func(*DriverOptions)

func WithCacheUri added in v1.1.1

func WithCacheUri(cacheUri string) func(*DriverOptions)

func WithClientID

func WithClientID(clientID string) func(*DriverOptions)

func WithClientSecret

func WithClientSecret(clientSecret string) func(*DriverOptions)

func WithClusterID

func WithClusterID(pclusterID string) func(*DriverOptions)

func WithEndpoint

func WithEndpoint(endpoint string) func(*DriverOptions)

func WithIdentityURL

func WithIdentityURL(identityURL string) func(*DriverOptions)

func WithMaxVolumesPerNode added in v1.2.1

func WithMaxVolumesPerNode(pmvpn int) func(*DriverOptions)

func WithMode

func WithMode(mode Mode) func(*DriverOptions)

func WithModifyVolumeRequestHandlerTimeout

func WithModifyVolumeRequestHandlerTimeout(timeout time.Duration) func(*DriverOptions)

func WithOtelTracing

func WithOtelTracing(enableOtelTracing bool) func(*DriverOptions)

func WithTagKeyLength

func WithTagKeyLength(ptkl int) func(*DriverOptions)

func WithTagValueLength

func WithTagValueLength(ptvl int) func(*DriverOptions)

func WithUserAgentExtra

func WithUserAgentExtra(userAgentExtra string) func(*DriverOptions)

func WithVServerURL

func WithVServerURL(vServerURL string) func(*DriverOptions)

Types

type CreateVolumeRequest

type CreateVolumeRequest struct {
	ClusterID          string // ClusterID is the ID of the cluster where the volume will be created.
	VolumeTypeID       string // the volume type UUID from the VngCloud portal API.
	VolumeName         string // the name of the PersistentVolume
	IsMultiAttach      bool   // whether the volume can be attached to multiple nodes
	VolumeSize         uint64 // the size of the volume in GB
	EncryptedAlgorithm string
	PvcNameTag         string // the name of the PVC on the PVC's Annotation
	PvcNamespaceTag    string // the namespace of the PVC on the PVC's Annotation
	PvNameTag          string // the name of the PV on the PVC's Annotation
	IsPoc              bool   // whether the volume is a PoC volume
	SnapshotID         string // the ID of the snapshot to create the volume from
	CreateFrom         lsdkVolumeV2.CreateVolumeFrom

	// The scope of mount commands
	BlockSize       string
	InodeSize       string
	BytesPerInode   string
	NumberOfInodes  string
	Ext4ClusterSize string
	Ext4BigAlloc    bool
	ReclaimPolicy   string

	DriverOptions *DriverOptions
}

func NewCreateVolumeRequest

func NewCreateVolumeRequest() *CreateVolumeRequest

func (*CreateVolumeRequest) ToResponseContext

func (s *CreateVolumeRequest) ToResponseContext(pvolCap []*lcsi.VolumeCapability) (map[string]string, error)

func (*CreateVolumeRequest) ToSdkCreateVolumeRequest added in v1.1.1

func (s *CreateVolumeRequest) ToSdkCreateVolumeRequest() lsdkVolumeV2.ICreateBlockVolumeRequest

func (*CreateVolumeRequest) WithBlockSize

func (s *CreateVolumeRequest) WithBlockSize(pblockSize string) *CreateVolumeRequest

func (*CreateVolumeRequest) WithBytesPerInode

func (s *CreateVolumeRequest) WithBytesPerInode(pbytesPerInode string) *CreateVolumeRequest

func (*CreateVolumeRequest) WithClusterID

func (s *CreateVolumeRequest) WithClusterID(pclusterID string) *CreateVolumeRequest

func (*CreateVolumeRequest) WithDriverOptions added in v1.1.1

func (s *CreateVolumeRequest) WithDriverOptions(pdo *DriverOptions) *CreateVolumeRequest

func (*CreateVolumeRequest) WithEncrypted

func (s *CreateVolumeRequest) WithEncrypted(pencrypted string) *CreateVolumeRequest

func (*CreateVolumeRequest) WithExt4BigAlloc

func (s *CreateVolumeRequest) WithExt4BigAlloc(pext4BigAlloc bool) *CreateVolumeRequest

func (*CreateVolumeRequest) WithExt4ClusterSize

func (s *CreateVolumeRequest) WithExt4ClusterSize(pext4ClusterSize string) *CreateVolumeRequest

func (*CreateVolumeRequest) WithInodeSize

func (s *CreateVolumeRequest) WithInodeSize(pinodeSize string) *CreateVolumeRequest

func (*CreateVolumeRequest) WithMultiAttach

func (s *CreateVolumeRequest) WithMultiAttach(pisMultiAttach bool) *CreateVolumeRequest

func (*CreateVolumeRequest) WithNumberOfInodes

func (s *CreateVolumeRequest) WithNumberOfInodes(pnumberOfInodes string) *CreateVolumeRequest

func (*CreateVolumeRequest) WithPoc

func (s *CreateVolumeRequest) WithPoc(pisPoc bool) *CreateVolumeRequest

func (*CreateVolumeRequest) WithPvNameTag

func (s *CreateVolumeRequest) WithPvNameTag(ppvNameTag string) *CreateVolumeRequest

func (*CreateVolumeRequest) WithPvcNameTag

func (s *CreateVolumeRequest) WithPvcNameTag(ppvcNameTag string) *CreateVolumeRequest

func (*CreateVolumeRequest) WithPvcNamespaceTag

func (s *CreateVolumeRequest) WithPvcNamespaceTag(ppvcNamespaceTag string) *CreateVolumeRequest

func (*CreateVolumeRequest) WithReclaimPolicy added in v1.2.0

func (s *CreateVolumeRequest) WithReclaimPolicy(ppolicy string) *CreateVolumeRequest

func (*CreateVolumeRequest) WithSnapshotID

func (s *CreateVolumeRequest) WithSnapshotID(psnapshotID string) *CreateVolumeRequest

func (*CreateVolumeRequest) WithVolumeName

func (s *CreateVolumeRequest) WithVolumeName(pvolumeName string) *CreateVolumeRequest

func (*CreateVolumeRequest) WithVolumeSize

func (s *CreateVolumeRequest) WithVolumeSize(pvolumeSize uint64) *CreateVolumeRequest

func (*CreateVolumeRequest) WithVolumeTypeID

func (s *CreateVolumeRequest) WithVolumeTypeID(pvolumeTypeID string) *CreateVolumeRequest

type DeviceIdentifier

type DeviceIdentifier interface {
	Lstat(name string) (os.FileInfo, error)
	EvalSymlinks(path string) (string, error)
}

type Driver

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

func NewDriver

func NewDriver(options ...func(*DriverOptions)) (*Driver, error)

func (*Driver) ControllerExpandVolume

func (s *Driver) ControllerExpandVolume(_ lctx.Context, preq *lcsi.ControllerExpandVolumeRequest) (*lcsi.ControllerExpandVolumeResponse, error)

func (*Driver) ControllerGetCapabilities

func (s *Driver) ControllerGetCapabilities(ctx lctx.Context, req *lcsi.ControllerGetCapabilitiesRequest) (*lcsi.ControllerGetCapabilitiesResponse, error)

func (*Driver) ControllerGetVolume

func (s *Driver) ControllerGetVolume(_ lctx.Context, preq *lcsi.ControllerGetVolumeRequest) (*lcsi.ControllerGetVolumeResponse, error)

func (*Driver) ControllerModifyVolume

func (s *Driver) ControllerModifyVolume(ctx lctx.Context, preq *lcsi.ControllerModifyVolumeRequest) (*lcsi.ControllerModifyVolumeResponse, error)

func (*Driver) ControllerPublishVolume

func (s *Driver) ControllerPublishVolume(pctx lctx.Context, preq *lcsi.ControllerPublishVolumeRequest) (result *lcsi.ControllerPublishVolumeResponse, err error)

func (*Driver) ControllerUnpublishVolume

func (s *Driver) ControllerUnpublishVolume(_ lctx.Context, preq *lcsi.ControllerUnpublishVolumeRequest) (*lcsi.ControllerUnpublishVolumeResponse, error)

func (*Driver) CreateSnapshot

func (s *Driver) CreateSnapshot(_ lctx.Context, preq *lcsi.CreateSnapshotRequest) (*lcsi.CreateSnapshotResponse, error)

func (*Driver) CreateVolume

func (s *Driver) CreateVolume(pctx lctx.Context, preq *lcsi.CreateVolumeRequest) (*lcsi.CreateVolumeResponse, error)

func (*Driver) DeleteSnapshot

func (s *Driver) DeleteSnapshot(_ lctx.Context, preq *lcsi.DeleteSnapshotRequest) (*lcsi.DeleteSnapshotResponse, error)

func (*Driver) DeleteVolume

func (s *Driver) DeleteVolume(pctx lctx.Context, preq *lcsi.DeleteVolumeRequest) (*lcsi.DeleteVolumeResponse, error)

func (*Driver) GetCapacity

func (s *Driver) GetCapacity(ctx lctx.Context, req *lcsi.GetCapacityRequest) (*lcsi.GetCapacityResponse, error)

func (*Driver) GetPluginInfo

func (*Driver) IsBlockDevice

func (s *Driver) IsBlockDevice(fullPath string) (bool, error)

IsBlock checks if the given path is a block device

func (*Driver) ListSnapshots

func (s *Driver) ListSnapshots(_ lctx.Context, preq *lcsi.ListSnapshotsRequest) (*lcsi.ListSnapshotsResponse, error)

func (*Driver) ListVolumes

func (s *Driver) ListVolumes(ctx lctx.Context, req *lcsi.ListVolumesRequest) (*lcsi.ListVolumesResponse, error)

func (*Driver) ModifyVolumeProperties

func (s *Driver) ModifyVolumeProperties(pctx lctx.Context, preq *lvmrpc.ModifyVolumePropertiesRequest) (*lvmrpc.ModifyVolumePropertiesResponse, error)

func (*Driver) NodeExpandVolume

func (s *Driver) NodeExpandVolume(_ lctx.Context, preq *lcsi.NodeExpandVolumeRequest) (*lcsi.NodeExpandVolumeResponse, error)

func (*Driver) NodeGetCapabilities

func (s *Driver) NodeGetCapabilities(_ lctx.Context, req *lcsi.NodeGetCapabilitiesRequest) (*lcsi.NodeGetCapabilitiesResponse, error)

func (*Driver) NodeGetInfo

func (s *Driver) NodeGetInfo(_ lctx.Context, _ *lcsi.NodeGetInfoRequest) (*lcsi.NodeGetInfoResponse, error)

func (*Driver) NodeGetVolumeStats

func (s *Driver) NodeGetVolumeStats(_ lctx.Context, preq *lcsi.NodeGetVolumeStatsRequest) (*lcsi.NodeGetVolumeStatsResponse, error)

func (*Driver) NodePublishVolume

func (s *Driver) NodePublishVolume(_ lctx.Context, preq *lcsi.NodePublishVolumeRequest) (*lcsi.NodePublishVolumeResponse, error)

func (*Driver) NodeStageVolume

func (s *Driver) NodeStageVolume(_ lctx.Context, preq *lcsi.NodeStageVolumeRequest) (*lcsi.NodeStageVolumeResponse, error)

func (*Driver) NodeUnpublishVolume

func (s *Driver) NodeUnpublishVolume(pctx lctx.Context, preq *lcsi.NodeUnpublishVolumeRequest) (*lcsi.NodeUnpublishVolumeResponse, error)

func (*Driver) NodeUnstageVolume

func (s *Driver) NodeUnstageVolume(ctx lctx.Context, preq *lcsi.NodeUnstageVolumeRequest) (*lcsi.NodeUnstageVolumeResponse, error)

func (*Driver) Probe

func (s *Driver) Probe(_ lctx.Context, preq *lcsi.ProbeRequest) (*lcsi.ProbeResponse, error)

func (*Driver) Run

func (s *Driver) Run() error

func (*Driver) ValidateVolumeCapabilities

func (s *Driver) ValidateVolumeCapabilities(pctx lctx.Context, preq *lcsi.ValidateVolumeCapabilitiesRequest) (*lcsi.ValidateVolumeCapabilitiesResponse, error)

type DriverOptions

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

func (*DriverOptions) GetTagKeyLength

func (s *DriverOptions) GetTagKeyLength() int

func (*DriverOptions) GetTagValueLength

func (s *DriverOptions) GetTagValueLength() int

type JSONPatch

type JSONPatch struct {
	OP    string      `json:"op,omitempty"`
	Path  string      `json:"path,omitempty"`
	Value interface{} `json:"value"`
}

type Mode

type Mode string

Mode is the operating mode of the CSI driver.

const (
	// ControllerMode is the mode that only starts the controller service.
	ControllerMode Mode = "controller"
	// NodeMode is the mode that only starts the node service.
	NodeMode Mode = "node"
	// AllMode is the mode that only starts both the controller and the node service.
	AllMode Mode = "all"
)

type Mounter

type Mounter interface {
	mountutils.Interface

	PathExists(path string) (bool, error)
	MakeDir(path string) error
	MakeFile(path string) error
	GetDeviceNameFromMount(mountPath string) (string, int, error)
	FormatAndMountSensitiveWithFormatOptions(source string, target string, fstype string, options []string, sensitiveOptions []string, formatOptions []string) error
	NeedResize(devicePath string, deviceMountPath string) (bool, error)
	NewResizeFs() (Resizefs, error)
	IsCorruptedMnt(err error) bool
	Unpublish(path string) error
	GetDevicePathBySerialID(pvolId string) (string, error)
	Unstage(path string) error
	GetMountFs(volumePath string) ([]byte, error)
}

type NodeMounter

type NodeMounter struct {
	*mountutils.SafeFormatAndMount
}

NodeMounter implements Mounter. A superstruct of SafeFormatAndMount.

func (NodeMounter) GetDeviceNameFromMount

func (s NodeMounter) GetDeviceNameFromMount(mountPath string) (string, int, error)

GetDeviceNameFromMount returns the volume ID for a mount path.

func (*NodeMounter) GetDevicePathBySerialID

func (s *NodeMounter) GetDevicePathBySerialID(pvolId string) (string, error)

func (*NodeMounter) GetMountFs

func (s *NodeMounter) GetMountFs(volumePath string) ([]byte, error)

func (NodeMounter) IsCorruptedMnt

func (s NodeMounter) IsCorruptedMnt(err error) bool

IsCorruptedMnt return true if err is about corrupted mount point

func (*NodeMounter) MakeDir

func (s *NodeMounter) MakeDir(path string) error

This function is mirrored in ./sanity_test.go to make sure sanity test covered this block of code Please mirror the change to func MakeFile in ./sanity_test.go

func (*NodeMounter) MakeFile

func (s *NodeMounter) MakeFile(path string) error

func (*NodeMounter) NeedResize

func (s *NodeMounter) NeedResize(devicePath string, deviceMountPath string) (bool, error)

func (*NodeMounter) NewResizeFs

func (s *NodeMounter) NewResizeFs() (Resizefs, error)

func (*NodeMounter) PathExists

func (s *NodeMounter) PathExists(path string) (bool, error)

func (*NodeMounter) Unpublish

func (s *NodeMounter) Unpublish(path string) error

func (*NodeMounter) Unstage

func (s *NodeMounter) Unstage(path string) error

type Resizefs

type Resizefs interface {
	Resize(devicePath, deviceMountPath string) (bool, error)
}

type VersionInfo

type VersionInfo struct {
	DriverVersion string `json:"driverVersion"`
	GitCommit     string `json:"gitCommit"`
	BuildDate     string `json:"buildDate"`
	GoVersion     string `json:"goVersion"`
	Compiler      string `json:"compiler"`
	Platform      string `json:"platform"`
}

func GetVersion

func GetVersion() VersionInfo

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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