mounter

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

README

This CSIProxyMounter code is copied from https://github.com/kubernetes-sigs/azuredisk-csi-driver/tree/18cf57775b5dcb4eac435feac5fbe13bb06216d1/pkg/mounter.

TODO consume this as a standalone module instead. This can't be included in the k8s.io/utils module because, by depending on kubernetes-csi/csi-proxy, it violates the criterion "No dependencies on any other Kubernetes repository."

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSafeMounter

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

Types

type CSIProxyMounter

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

func NewCSIProxyMounter

func NewCSIProxyMounter() (*CSIProxyMounter, error)

NewCSIProxyMounter - creates a new CSI Proxy mounter struct which encompassed all the clients to the CSI proxy - filesystem, disk and volume clients.

func (*CSIProxyMounter) DeviceOpened

func (mounter *CSIProxyMounter) DeviceOpened(pathname string) (bool, error)
func (mounter *CSIProxyMounter) EvalHostSymlinks(pathname string) (string, error)

func (*CSIProxyMounter) ExistsPath

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

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

func (*CSIProxyMounter) FindDiskByLun

func (mounter *CSIProxyMounter) FindDiskByLun(lun string) (diskNum string, err error)

FindDiskByLun - given a lun number, find out the corresponding disk

func (*CSIProxyMounter) FormatAndMount

func (mounter *CSIProxyMounter) 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.

func (*CSIProxyMounter) GetDeviceNameFromMount

func (mounter *CSIProxyMounter) GetDeviceNameFromMount(mountPath, pluginMountDir string) (string, error)

GetDeviceNameFromMount returns the volume ID for a mount path.

func (*CSIProxyMounter) GetFSGroup

func (mounter *CSIProxyMounter) GetFSGroup(pathname string) (int64, error)

func (*CSIProxyMounter) GetMode

func (mounter *CSIProxyMounter) GetMode(pathname string) (os.FileMode, error)

func (*CSIProxyMounter) GetMountRefs

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

func (*CSIProxyMounter) GetSELinuxSupport

func (mounter *CSIProxyMounter) GetSELinuxSupport(pathname string) (bool, error)

func (*CSIProxyMounter) GetVolumeSizeInBytes

func (mounter *CSIProxyMounter) GetVolumeSizeInBytes(devicePath string) (int64, error)

GetVolumeSizeInBytes returns the size of the volume in bytes.

func (*CSIProxyMounter) IsLikelyNotMountPoint

func (mounter *CSIProxyMounter) IsLikelyNotMountPoint(path string) (bool, error)

IsLikelyMountPoint - If the directory does not exists, the function will return os.ErrNotExist error.

If the path exists, call to CSI proxy will check if its a link, if its a link then existence of target
path is checked.

func (*CSIProxyMounter) IsMountPointMatch

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

func (*CSIProxyMounter) List

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

func (*CSIProxyMounter) MakeDir

func (mounter *CSIProxyMounter) MakeDir(pathname string) error

MakeDir - Creates a directory. The CSI proxy takes in context information. Currently the make dir is only used from the staging code path, hence we call it with Plugin context..

func (*CSIProxyMounter) MakeFile

func (mounter *CSIProxyMounter) MakeFile(pathname string) error

func (*CSIProxyMounter) MakeRShared

func (mounter *CSIProxyMounter) MakeRShared(path string) error

func (*CSIProxyMounter) Mount

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

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

func (*CSIProxyMounter) MountSensitive

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

func (*CSIProxyMounter) MountSensitiveWithoutSystemd

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

func (*CSIProxyMounter) PathIsDevice

func (mounter *CSIProxyMounter) PathIsDevice(pathname string) (bool, error)

func (*CSIProxyMounter) Rescan

func (mounter *CSIProxyMounter) Rescan() error

Rescan would trigger an update storage cache via the CSI proxy.

func (*CSIProxyMounter) ResizeVolume

func (mounter *CSIProxyMounter) ResizeVolume(devicePath string) error

ResizeVolume resizes the volume to the maximum available size.

func (*CSIProxyMounter) Rmdir

func (mounter *CSIProxyMounter) Rmdir(path string) error

Rmdir - delete the given directory TODO: Call separate rmdir for pod context and plugin context. v1alpha1 for CSI

proxy does a relaxed check for prefix as c:\var\lib\kubelet, so we can do
rmdir with either pod or plugin context.

func (*CSIProxyMounter) Unmount

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

Unmount - Removes the directory - equivalent to unmount on Linux.

Jump to

Keyboard shortcuts

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