driver

package
v0.0.0-...-b702281 Latest Latest
Warning

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

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

Documentation

Overview

Package driver is a generated GoMock package.

Index

Constants

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 (
	// 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"

	// Ext4ClusterSizeKey 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"
)

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

constants of keys in PublishContext

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

constants of keys in VolumeContext

View Source
const (
	VolumeOperationAlreadyExists = "An operation with the given volume=%q is already in progress"
)

Variables

View Source
var (
	FileSystemConfigs = map[string]fileSystemConfig{
		FSTypeExt2: {
			NotSupportedParams: map[string]struct{}{},
		},
		FSTypeExt3: {
			NotSupportedParams: map[string]struct{}{},
		},
		FSTypeExt4: {
			NotSupportedParams: map[string]struct{}{},
		},
		FSTypeXfs: {
			NotSupportedParams: map[string]struct{}{
				BytesPerInodeKey:  {},
				NumberOfInodesKey: {},
			},
		},
		FSTypeNtfs: {
			NotSupportedParams: map[string]struct{}{
				BlockSizeKey:      {},
				InodeSizeKey:      {},
				BytesPerInodeKey:  {},
				NumberOfInodesKey: {},
			},
		},
	}
)
View Source
var (
	ValidFSTypes = map[string]struct{}{
		FSTypeExt2: {},
		FSTypeExt3: {},
		FSTypeExt4: {},
		FSTypeXfs:  {},
		FSTypeNtfs: {},
	}
)

Functions

func WithEndpoint

func WithEndpoint(endpoint string) func(*DriverOptions)

Types

type DeviceIdentifier

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

DeviceIdentifier is for mocking os io functions used for the driver to identify an EBS volume's corresponding device (in Linux, the path under /dev; in Windows, the volume number) so that it can mount it. For volumes already mounted, see GetDeviceNameFromMount. https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/nvme-ebs-volumes.html#identify-nvme-ebs-device

type Driver

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

Driver encapsulates the GRPC server and the node service which implements all necessary interfaces, such as the EBS volume stats interface.

func NewDriver

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

NewDriver creates a new driver.

func (*Driver) IsBlockDevice

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

IsBlock checks if the given path is a block device

func (*Driver) NodeGetCapabilities

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

Returns the capabilities of this node service.

func (*Driver) NodeGetVolumeStats

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

func (*Driver) NodeStageVolume

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

func (*Driver) NodeUnstageVolume

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

func (*Driver) Run

func (d *Driver) Run() error

func (*Driver) Stop

func (d *Driver) Stop()

type DriverOptions

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

DriverOptions supports to custom the endpoint of the GRPC server.

type MockDeviceIdentifier

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

MockDeviceIdentifier is a mock of DeviceIdentifier interface.

func NewMockDeviceIdentifier

func NewMockDeviceIdentifier(ctrl *gomock.Controller) *MockDeviceIdentifier

NewMockDeviceIdentifier creates a new mock instance.

func (*MockDeviceIdentifier) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (m *MockDeviceIdentifier) EvalSymlinks(path string) (string, error)

EvalSymlinks mocks base method.

func (*MockDeviceIdentifier) Lstat

func (m *MockDeviceIdentifier) Lstat(name string) (os.FileInfo, error)

Lstat mocks base method.

type MockDeviceIdentifierMockRecorder

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

MockDeviceIdentifierMockRecorder is the mock recorder for MockDeviceIdentifier.

func (mr *MockDeviceIdentifierMockRecorder) EvalSymlinks(path interface{}) *gomock.Call

EvalSymlinks indicates an expected call of EvalSymlinks.

func (*MockDeviceIdentifierMockRecorder) Lstat

func (mr *MockDeviceIdentifierMockRecorder) Lstat(name interface{}) *gomock.Call

Lstat indicates an expected call of Lstat.

type MockMounter

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

MockMounter is a mock of Mounter interface.

func NewMockMounter

func NewMockMounter(ctrl *gomock.Controller) *MockMounter

NewMockMounter creates a new mock instance.

func (*MockMounter) CanSafelySkipMountPointCheck

func (m *MockMounter) CanSafelySkipMountPointCheck() bool

CanSafelySkipMountPointCheck mocks base method.

func (*MockMounter) EXPECT

func (m *MockMounter) EXPECT() *MockMounterMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockMounter) FormatAndMountSensitiveWithFormatOptions

func (m *MockMounter) FormatAndMountSensitiveWithFormatOptions(source, target, fstype string, options, sensitiveOptions, formatOptions []string) error

FormatAndMountSensitiveWithFormatOptions mocks base method.

func (*MockMounter) GetDeviceNameFromMount

func (m *MockMounter) GetDeviceNameFromMount(mountPath string) (string, int, error)

GetDeviceNameFromMount mocks base method.

func (*MockMounter) GetMountRefs

func (m *MockMounter) GetMountRefs(pathname string) ([]string, error)

GetMountRefs mocks base method.

func (*MockMounter) IsCorruptedMnt

func (m *MockMounter) IsCorruptedMnt(err error) bool

IsCorruptedMnt mocks base method.

func (*MockMounter) IsLikelyNotMountPoint

func (m *MockMounter) IsLikelyNotMountPoint(file string) (bool, error)

IsLikelyNotMountPoint mocks base method.

func (*MockMounter) IsMountPoint

func (m *MockMounter) IsMountPoint(file string) (bool, error)

IsMountPoint mocks base method.

func (*MockMounter) List

func (m *MockMounter) List() ([]mount_utils.MountPoint, error)

List mocks base method.

func (*MockMounter) MakeDir

func (m *MockMounter) MakeDir(path string) error

MakeDir mocks base method.

func (*MockMounter) MakeFile

func (m *MockMounter) MakeFile(path string) error

MakeFile mocks base method.

func (*MockMounter) Mount

func (m *MockMounter) Mount(source, target, fstype string, options []string) error

Mount mocks base method.

func (*MockMounter) MountSensitive

func (m *MockMounter) MountSensitive(source, target, fstype string, options, sensitiveOptions []string) error

MountSensitive mocks base method.

func (*MockMounter) MountSensitiveWithoutSystemd

func (m *MockMounter) MountSensitiveWithoutSystemd(source, target, fstype string, options, sensitiveOptions []string) error

MountSensitiveWithoutSystemd mocks base method.

func (*MockMounter) MountSensitiveWithoutSystemdWithMountFlags

func (m *MockMounter) MountSensitiveWithoutSystemdWithMountFlags(source, target, fstype string, options, sensitiveOptions, mountFlags []string) error

MountSensitiveWithoutSystemdWithMountFlags mocks base method.

func (*MockMounter) NeedResize

func (m *MockMounter) NeedResize(devicePath, deviceMountPath string) (bool, error)

NeedResize mocks base method.

func (*MockMounter) NewResizeFs

func (m *MockMounter) NewResizeFs() (Resizefs, error)

NewResizeFs mocks base method.

func (*MockMounter) PathExists

func (m *MockMounter) PathExists(path string) (bool, error)

PathExists mocks base method.

func (*MockMounter) Unmount

func (m *MockMounter) Unmount(target string) error

Unmount mocks base method.

func (*MockMounter) Unpublish

func (m *MockMounter) Unpublish(path string) error

Unpublish mocks base method.

func (*MockMounter) Unstage

func (m *MockMounter) Unstage(path string) error

Unstage mocks base method.

type MockMounterMockRecorder

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

MockMounterMockRecorder is the mock recorder for MockMounter.

func (*MockMounterMockRecorder) CanSafelySkipMountPointCheck

func (mr *MockMounterMockRecorder) CanSafelySkipMountPointCheck() *gomock.Call

CanSafelySkipMountPointCheck indicates an expected call of CanSafelySkipMountPointCheck.

func (*MockMounterMockRecorder) FormatAndMountSensitiveWithFormatOptions

func (mr *MockMounterMockRecorder) FormatAndMountSensitiveWithFormatOptions(source, target, fstype, options, sensitiveOptions, formatOptions interface{}) *gomock.Call

FormatAndMountSensitiveWithFormatOptions indicates an expected call of FormatAndMountSensitiveWithFormatOptions.

func (*MockMounterMockRecorder) GetDeviceNameFromMount

func (mr *MockMounterMockRecorder) GetDeviceNameFromMount(mountPath interface{}) *gomock.Call

GetDeviceNameFromMount indicates an expected call of GetDeviceNameFromMount.

func (*MockMounterMockRecorder) GetMountRefs

func (mr *MockMounterMockRecorder) GetMountRefs(pathname interface{}) *gomock.Call

GetMountRefs indicates an expected call of GetMountRefs.

func (*MockMounterMockRecorder) IsCorruptedMnt

func (mr *MockMounterMockRecorder) IsCorruptedMnt(err interface{}) *gomock.Call

IsCorruptedMnt indicates an expected call of IsCorruptedMnt.

func (*MockMounterMockRecorder) IsLikelyNotMountPoint

func (mr *MockMounterMockRecorder) IsLikelyNotMountPoint(file interface{}) *gomock.Call

IsLikelyNotMountPoint indicates an expected call of IsLikelyNotMountPoint.

func (*MockMounterMockRecorder) IsMountPoint

func (mr *MockMounterMockRecorder) IsMountPoint(file interface{}) *gomock.Call

IsMountPoint indicates an expected call of IsMountPoint.

func (*MockMounterMockRecorder) List

func (mr *MockMounterMockRecorder) List() *gomock.Call

List indicates an expected call of List.

func (*MockMounterMockRecorder) MakeDir

func (mr *MockMounterMockRecorder) MakeDir(path interface{}) *gomock.Call

MakeDir indicates an expected call of MakeDir.

func (*MockMounterMockRecorder) MakeFile

func (mr *MockMounterMockRecorder) MakeFile(path interface{}) *gomock.Call

MakeFile indicates an expected call of MakeFile.

func (*MockMounterMockRecorder) Mount

func (mr *MockMounterMockRecorder) Mount(source, target, fstype, options interface{}) *gomock.Call

Mount indicates an expected call of Mount.

func (*MockMounterMockRecorder) MountSensitive

func (mr *MockMounterMockRecorder) MountSensitive(source, target, fstype, options, sensitiveOptions interface{}) *gomock.Call

MountSensitive indicates an expected call of MountSensitive.

func (*MockMounterMockRecorder) MountSensitiveWithoutSystemd

func (mr *MockMounterMockRecorder) MountSensitiveWithoutSystemd(source, target, fstype, options, sensitiveOptions interface{}) *gomock.Call

MountSensitiveWithoutSystemd indicates an expected call of MountSensitiveWithoutSystemd.

func (*MockMounterMockRecorder) MountSensitiveWithoutSystemdWithMountFlags

func (mr *MockMounterMockRecorder) MountSensitiveWithoutSystemdWithMountFlags(source, target, fstype, options, sensitiveOptions, mountFlags interface{}) *gomock.Call

MountSensitiveWithoutSystemdWithMountFlags indicates an expected call of MountSensitiveWithoutSystemdWithMountFlags.

func (*MockMounterMockRecorder) NeedResize

func (mr *MockMounterMockRecorder) NeedResize(devicePath, deviceMountPath interface{}) *gomock.Call

NeedResize indicates an expected call of NeedResize.

func (*MockMounterMockRecorder) NewResizeFs

func (mr *MockMounterMockRecorder) NewResizeFs() *gomock.Call

NewResizeFs indicates an expected call of NewResizeFs.

func (*MockMounterMockRecorder) PathExists

func (mr *MockMounterMockRecorder) PathExists(path interface{}) *gomock.Call

PathExists indicates an expected call of PathExists.

func (*MockMounterMockRecorder) Unmount

func (mr *MockMounterMockRecorder) Unmount(target interface{}) *gomock.Call

Unmount indicates an expected call of Unmount.

func (*MockMounterMockRecorder) Unpublish

func (mr *MockMounterMockRecorder) Unpublish(path interface{}) *gomock.Call

Unpublish indicates an expected call of Unpublish.

func (*MockMounterMockRecorder) Unstage

func (mr *MockMounterMockRecorder) Unstage(path interface{}) *gomock.Call

Unstage indicates an expected call of Unstage.

type MockResizefs

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

MockResizefs is a mock of Resizefs interface.

func NewMockResizefs

func NewMockResizefs(ctrl *gomock.Controller) *MockResizefs

NewMockResizefs creates a new mock instance.

func (*MockResizefs) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockResizefs) Resize

func (m *MockResizefs) Resize(devicePath, deviceMountPath string) (bool, error)

Resize mocks base method.

type MockResizefsMockRecorder

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

MockResizefsMockRecorder is the mock recorder for MockResizefs.

func (*MockResizefsMockRecorder) Resize

func (mr *MockResizefsMockRecorder) Resize(devicePath, deviceMountPath interface{}) *gomock.Call

Resize indicates an expected call of Resize.

type Mounter

type Mounter interface {
	mountutils.Interface

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

Mounter is the interface implemented by NodeMounter. A mix & match of functions defined in upstream libraries. (FormatAndMount from struct SafeFormatAndMount, PathExists from an old edition of mount.Interface). Define it explicitly so that it can be mocked and to insulate from oft-changing upstream interfaces/structs

type NodeMounter

type NodeMounter struct {
	*mountutils.SafeFormatAndMount
}

NodeMounter implements Mounter. A superstruct of SafeFormatAndMount.

func (NodeMounter) GetDeviceNameFromMount

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

GetDeviceNameFromMount returns the volume ID for a mount path.

func (NodeMounter) IsCorruptedMnt

func (m NodeMounter) IsCorruptedMnt(err error) bool

IsCorruptedMnt return true if err is about corrupted mount point

func (*NodeMounter) MakeDir

func (m *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 (m *NodeMounter) MakeFile(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) NeedResize

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

func (*NodeMounter) NewResizeFs

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

func (*NodeMounter) PathExists

func (m *NodeMounter) PathExists(path string) (bool, 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) Unpublish

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

func (*NodeMounter) Unstage

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

type Resizefs

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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