mountmanager

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2021 License: Apache-2.0 Imports: 14 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCustomFakeSafeMounter added in v0.6.0

func NewCustomFakeSafeMounter(mounter mount.Interface, exec exec.Interface) *mount.SafeFormatAndMount

func NewDeviceUtils added in v0.2.0

func NewDeviceUtils() *deviceUtils

func NewFakeDeviceUtils added in v0.2.0

func NewFakeDeviceUtils() *fakeDeviceUtils

func NewFakeSafeBlockingMounter added in v0.6.0

func NewFakeSafeBlockingMounter(readyToExecute chan chan struct{}) *mount.SafeFormatAndMount

func NewFakeSafeMounter added in v0.2.0

func NewFakeSafeMounter() *mount.SafeFormatAndMount

func NewFakeSafeMounterWithCustomExec added in v0.6.0

func NewFakeSafeMounterWithCustomExec(exec exec.Interface) *mount.SafeFormatAndMount

func NewFakeStatter added in v0.7.0

func NewFakeStatter(mounter *mount.SafeFormatAndMount) *fakeStatter

func NewSafeMounter added in v0.2.0

func NewSafeMounter() (*mount.SafeFormatAndMount, error)

func NewStatter added in v0.7.0

func NewStatter(mounter *mount.SafeFormatAndMount) *realStatter

Types

type CSIProxyMounter added in v1.0.0

type CSIProxyMounter interface {
	mount.Interface

	// GetAPIVersions returns the versions of the client APIs this mounter is using.
	GetAPIVersions() string

	// Delete the given directory with Pod context. CSI proxy does a check for path prefix
	// based on context
	RemovePodDir(target string) error

	// UnmountDevice uses target path to find the volume id first, and then
	// call DismountVolume through csi-proxy. If succeeded, it will delete the given path
	// at last step. CSI proxy does a check for path prefix
	// based on context
	UnmountDevice(target string) error

	// GetDiskNumber finds the disk number of the given device name
	GetDiskNumber(deviceName string, partition string, volumeKey string) (string, error)

	// FormatAndMount accepts the source disk number, target path to mount, the fstype to format with and options to be used.
	// After formatting, it will mount the disk to target path on the host
	FormatAndMount(source string, target string, fstype string, options []string) error

	// IsMountPointMatch checks if the mount point matches the directory `dir`
	IsMountPointMatch(mp mount.MountPoint, dir string) bool

	// ExistsPath checks if a path exists.
	// Unlike util ExistsPath, this call does not perform follow link.
	ExistsPath(path string) (bool, error)

	// GetDiskTotalBytes gets the total size of a disk
	GetDiskTotalBytes(devicePath string) (int64, error)
}

CSIProxyMounter is the mounter interface exposed as a utility to internal methods

type CSIProxyMounterV1 added in v1.3.0

type CSIProxyMounterV1 struct {
	FsClient     *fsclient.Client
	DiskClient   *diskclient.Client
	VolumeClient *volumeclient.Client
}

CSIProxyMounterV1 is the mounter implementation that uses the v1 API

func NewCSIProxyMounterV1 added in v1.3.0

func NewCSIProxyMounterV1() (*CSIProxyMounterV1, error)

func (*CSIProxyMounterV1) ExistsPath added in v1.3.0

func (mounter *CSIProxyMounterV1) ExistsPath(path string) (bool, error)

ExistsPath - Checks if a path exists. Unlike util ExistsPath, this call does not perform follow link.

func (*CSIProxyMounterV1) FormatAndMount added in v1.3.0

func (mounter *CSIProxyMounterV1) FormatAndMount(source string, target string, fstype string, options []string) error

FormatAndMount accepts the source disk number, target path to mount, the fstype to format with and options to be used. After formatting, it will mount the disk to target path on the host

func (*CSIProxyMounterV1) GetAPIVersions added in v1.3.0

func (mounter *CSIProxyMounterV1) GetAPIVersions() string

GetAPIVersions returns the versions of the client APIs this mounter is using.

func (*CSIProxyMounterV1) GetDiskNumber added in v1.3.0

func (mounter *CSIProxyMounterV1) GetDiskNumber(deviceName string, partition string, volumeKey string) (string, error)

func (*CSIProxyMounterV1) GetDiskTotalBytes added in v1.3.0

func (mounter *CSIProxyMounterV1) GetDiskTotalBytes(devicePath string) (int64, error)

func (*CSIProxyMounterV1) GetMountRefs added in v1.3.0

func (mounter *CSIProxyMounterV1) GetMountRefs(pathname string) ([]string, error)

func (*CSIProxyMounterV1) IsLikelyNotMountPoint added in v1.3.0

func (mounter *CSIProxyMounterV1) IsLikelyNotMountPoint(file string) (bool, error)

func (*CSIProxyMounterV1) IsMountPointMatch added in v1.3.0

func (mounter *CSIProxyMounterV1) IsMountPointMatch(mp mount.MountPoint, dir string) bool

func (*CSIProxyMounterV1) List added in v1.3.0

func (mounter *CSIProxyMounterV1) List() ([]mount.MountPoint, error)

func (*CSIProxyMounterV1) Mount added in v1.3.0

func (mounter *CSIProxyMounterV1) Mount(source string, target string, fstype string, options []string) error

Mount just creates a soft link at target pointing to source.

func (*CSIProxyMounterV1) MountSensitive added in v1.3.0

func (mounter *CSIProxyMounterV1) MountSensitive(source string, target string, fstype string, options []string, sensitiveOptions []string) error

MountSensitive is the same as Mount() but this method allows sensitiveOptions to be passed in a separate parameter from the normal mount options and ensures the sensitiveOptions are never logged. Since Mount here is just create a synlink, so options and sensitiveOptions are not used here

func (*CSIProxyMounterV1) MountSensitiveWithoutSystemd added in v1.3.0

func (mounter *CSIProxyMounterV1) MountSensitiveWithoutSystemd(source string, target string, fstype string, options []string, sensitiveOptions []string) error

MountSensitiveWithoutSystemd is the same as MountSensitive() but this method disable using systemd mount. It's unimplemented in PD CSI Driver

func (*CSIProxyMounterV1) RemovePodDir added in v1.3.0

func (mounter *CSIProxyMounterV1) RemovePodDir(target string) error

Delete the given directory with Pod context. CSI proxy does a check for path prefix based on context

func (*CSIProxyMounterV1) Unmount added in v1.3.0

func (mounter *CSIProxyMounterV1) Unmount(target string) error

func (*CSIProxyMounterV1) UnmountDevice added in v1.3.0

func (mounter *CSIProxyMounterV1) UnmountDevice(target string) error

UnmountDevice uses target path to find the volume id first, and then call DismountVolume through csi-proxy. If succeeded, it will delete the given path at last step. CSI proxy does a check for path prefix based on context

type CSIProxyMounterV1Beta added in v1.3.0

type CSIProxyMounterV1Beta struct {
	FsClient     *fsclient.Client
	DiskClient   *diskclient.Client
	VolumeClient *volumeclient.Client
}

CSIProxyMounterV1Beta is the mounter implementaiton that uses the v1beta API

func NewCSIProxyMounterV1Beta added in v1.3.0

func NewCSIProxyMounterV1Beta() (*CSIProxyMounterV1Beta, error)

func (*CSIProxyMounterV1Beta) ExistsPath added in v1.3.0

func (mounter *CSIProxyMounterV1Beta) ExistsPath(path string) (bool, error)

ExistsPath - Checks if a path exists. Unlike util ExistsPath, this call does not perform follow link.

func (*CSIProxyMounterV1Beta) FormatAndMount added in v1.3.0

func (mounter *CSIProxyMounterV1Beta) FormatAndMount(source string, target string, fstype string, options []string) error

FormatAndMount accepts the source disk number, target path to mount, the fstype to format with and options to be used. After formatting, it will mount the disk to target path on the host

func (*CSIProxyMounterV1Beta) GetAPIVersions added in v1.3.0

func (mounter *CSIProxyMounterV1Beta) GetAPIVersions() string

GetAPIVersions returns the versions of the client APIs this mounter is using.

func (*CSIProxyMounterV1Beta) GetDiskNumber added in v1.3.0

func (mounter *CSIProxyMounterV1Beta) GetDiskNumber(deviceName string, partition string, volumeKey string) (string, error)

func (*CSIProxyMounterV1Beta) GetDiskTotalBytes added in v1.3.0

func (mounter *CSIProxyMounterV1Beta) GetDiskTotalBytes(devicePath string) (int64, error)

func (*CSIProxyMounterV1Beta) GetMountRefs added in v1.3.0

func (mounter *CSIProxyMounterV1Beta) GetMountRefs(pathname string) ([]string, error)

func (*CSIProxyMounterV1Beta) IsLikelyNotMountPoint added in v1.3.0

func (mounter *CSIProxyMounterV1Beta) IsLikelyNotMountPoint(file string) (bool, error)

func (*CSIProxyMounterV1Beta) IsMountPointMatch added in v1.3.0

func (mounter *CSIProxyMounterV1Beta) IsMountPointMatch(mp mount.MountPoint, dir string) bool

func (*CSIProxyMounterV1Beta) List added in v1.3.0

func (mounter *CSIProxyMounterV1Beta) List() ([]mount.MountPoint, error)

func (*CSIProxyMounterV1Beta) Mount added in v1.3.0

func (mounter *CSIProxyMounterV1Beta) Mount(source string, target string, fstype string, options []string) error

Mount just creates a soft link at target pointing to source.

func (*CSIProxyMounterV1Beta) MountSensitive added in v1.3.0

func (mounter *CSIProxyMounterV1Beta) MountSensitive(source string, target string, fstype string, options []string, sensitiveOptions []string) error

MountSensitive is the same as Mount() but this method allows sensitiveOptions to be passed in a separate parameter from the normal mount options and ensures the sensitiveOptions are never logged. Since Mount here is just create a synlink, so options and sensitiveOptions are not used here

func (*CSIProxyMounterV1Beta) MountSensitiveWithoutSystemd added in v1.3.0

func (mounter *CSIProxyMounterV1Beta) MountSensitiveWithoutSystemd(source string, target string, fstype string, options []string, sensitiveOptions []string) error

MountSensitiveWithoutSystemd is the same as MountSensitive() but this method disable using systemd mount. It's unimplemented in PD CSI Driver

func (*CSIProxyMounterV1Beta) RemovePodDir added in v1.3.0

func (mounter *CSIProxyMounterV1Beta) RemovePodDir(target string) error

Delete the given directory with Pod context. CSI proxy does a check for path prefix based on context

func (*CSIProxyMounterV1Beta) Unmount added in v1.3.0

func (mounter *CSIProxyMounterV1Beta) Unmount(target string) error

func (*CSIProxyMounterV1Beta) UnmountDevice added in v1.3.0

func (mounter *CSIProxyMounterV1Beta) UnmountDevice(target string) error

UnmountDevice uses target path to find the volume id first, and then call DismountVolume through csi-proxy. If succeeded, it will delete the given path at last step. CSI proxy does a check for path prefix based on context

type DeviceUtils added in v0.2.0

type DeviceUtils interface {
	// GetDiskByIdPaths returns a list of all possible paths for a
	// given Persistent Disk
	GetDiskByIdPaths(deviceName string, partition string) []string

	// VerifyDevicePath returns the first of the list of device paths that
	// exists on the machine, or an empty string if none exists
	VerifyDevicePath(devicePaths []string, deviceName string) (string, error)
}

DeviceUtils are a collection of methods that act on the devices attached to a GCE Instance

type FakeBlockingMounter added in v0.6.0

type FakeBlockingMounter struct {
	*mount.FakeMounter
	ReadyToExecute chan chan struct{}
}

func (*FakeBlockingMounter) Mount added in v0.6.0

func (mounter *FakeBlockingMounter) Mount(source string, target string, fstype string, options []string) error

Mount is overridden and adds functionality to finely control the order of execution of FakeMounter's Mount calls. Upon starting a Mount, it passes a chan 'executeMount' into readyToExecute, then blocks on executeMount. The test calling this function can block on readyToExecute to ensure that the operation has started and allowed the Mount to continue by passing a struct into executeMount.

type Statter added in v0.7.0

type Statter interface {
	StatFS(path string) (int64, int64, int64, int64, int64, int64, error)
	IsBlockDevice(string) (bool, error)
}

Jump to

Keyboard shortcuts

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