mount

package
v0.0.0-...-eec02a6 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func New

func New() (*Client, error)

func NewDetailed

func NewDetailed(mountOS mountOS) *Client

func (*Client) AttachNFSVolume

func (c *Client) AttachNFSVolume(ctx context.Context, name, mountpoint string,
	publishInfo *models.VolumePublishInfo,
) error

AttachNFSVolume attaches the volume to the local host. This method must be able to accomplish its task using only the data passed in. It may be assumed that this method always runs on the host to which the volume will be attached.

func (*Client) AttachSMBVolume

func (c *Client) AttachSMBVolume(
	ctx context.Context, name, mountpoint, username, password string, publishInfo *models.VolumePublishInfo,
) error

AttachSMBVolume attaches the volume to the local host. This method must be able to accomplish its task using only the data passed in. It may be assumed that this method always runs on the host to which the volume will be attached.

func (*Client) MountFilesystemForResize

func (c *Client) MountFilesystemForResize(
	ctx context.Context, devicePath, stagedTargetPath, mountOptions string,
) (string, error)

MountFilesystemForResize expands a filesystem. The xfs_growfs utility requires a mount point to expand the filesystem. Determining the size of the filesystem requires that the filesystem be mounted.

type FilesystemClient

type FilesystemClient interface {
	fs.FilesystemClient
}

FilesystemClient is a wrapper around the filesystem client to help generate mocks

type LinuxClient

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

func (*LinuxClient) ConsistentRead

func (client *LinuxClient) ConsistentRead(filename string, attempts int) ([]byte, error)

ConsistentRead repeatedly reads a file until it gets the same content twice. This is useful when reading files in /proc that are larger than page size and kernel may modify them between individual read() syscalls.

func (*LinuxClient) ConsistentReadMount

func (client *LinuxClient) ConsistentReadMount(ctx context.Context, filename, mountpoint, sourceDevice, devicePath string, maxAttempts int) (*models.MountInfo, error)

ConsistentReadMount verifies whether a specific mountpoint and source device consistently appear in the mount file. It reads the file up to maxAttempts times, returning parsedEntry if the same matching entry is found in two consecutive reads. Returns nil and an error if either the entry was present but not consistently found within the allowed attempts or there was an error. Returns nil and nil if the entry was never found.

func (*LinuxClient) EnsureDirExists

func (client *LinuxClient) EnsureDirExists(ctx context.Context, path string) error

func (*LinuxClient) EnsureFileExists

func (client *LinuxClient) EnsureFileExists(ctx context.Context, path string) error

func (*LinuxClient) GetHostMountInfo

func (client *LinuxClient) GetHostMountInfo(ctx context.Context) ([]models.MountInfo, error)

GetHostMountInfo returns the list of mounts found in /proc/1/mountinfo

func (*LinuxClient) GetSelfMountInfo

func (client *LinuxClient) GetSelfMountInfo(ctx context.Context) ([]models.MountInfo, error)

GetSelfMountInfo returns the list of mounts found in /proc/self/mountinfo

func (*LinuxClient) IsCompatible

func (client *LinuxClient) IsCompatible(ctx context.Context, protocol string) error

IsCompatible checks for compatibility of protocol and platform

func (*LinuxClient) IsLikelyNotMountPoint

func (client *LinuxClient) IsLikelyNotMountPoint(ctx context.Context, mountpoint string) (bool, error)

IsLikelyNotMountPoint uses heuristics to determine if a directory is not a mountpoint. It should return ErrNotExist when the directory does not exist. IsLikelyNotMountPoint does NOT properly detect all mountpoint types most notably Linux bind mounts and symbolic links. For callers that do not care about such situations, this is a faster alternative to scanning the list of mounts. A return value of false means the directory is definitely a mount point. A return value of true means it's not a mount this function knows how to find, but it could still be a mount point.

func (*LinuxClient) IsMounted

func (client *LinuxClient) IsMounted(ctx context.Context, sourceDevice, mountpoint, mountOptions string) (bool, error)

IsMounted verifies if the supplied device is attached at the supplied location. If no source device is specified, any existing mount with the specified mountpoint returns true. If no mountpoint is specified, any existing mount with the specified device returns true.

func (*LinuxClient) IsNFSShareMounted

func (client *LinuxClient) IsNFSShareMounted(ctx context.Context, exportPath, mountpoint string) (bool, error)

func (*LinuxClient) ListMountinfo

func (client *LinuxClient) ListMountinfo(mountFilePath string) ([]models.MountInfo, error)

func (*LinuxClient) ListProcHostMountinfo

func (client *LinuxClient) ListProcHostMountinfo() ([]models.MountInfo, error)

func (*LinuxClient) ListProcMountinfo

func (client *LinuxClient) ListProcMountinfo() ([]models.MountInfo, error)

ListProcMountinfo (Available since Linux 2.6.26) lists information about mount points in the process's mount namespace. Ref: http://man7.org/linux/man-pages/man5/proc.5.html for /proc/[pid]/mountinfo

func (*LinuxClient) ListProcMounts

func (client *LinuxClient) ListProcMounts(mountFilePath string) ([]models.MountPoint, error)

func (*LinuxClient) MountDevice

func (client *LinuxClient) MountDevice(ctx context.Context, device, mountpoint, options string,
	isMountPointFile bool,
) error

MountDevice attaches the supplied device at the supplied location. Use this for iSCSI devices.

func (*LinuxClient) MountNFSPath

func (client *LinuxClient) MountNFSPath(ctx context.Context, exportPath, mountpoint, options string) error

MountNFSPath attaches the supplied NFS share at the supplied location with options.

func (*LinuxClient) MountSMBPath

func (client *LinuxClient) MountSMBPath(ctx context.Context, exportPath, mountpoint, username, password string) error

MountSMBPath is a dummy added for compilation on non-windows platform.

func (*LinuxClient) PVMountpointMappings

func (client *LinuxClient) PVMountpointMappings(ctx context.Context) (map[string]string, error)

PVMountpointMappings identifies devices corresponding to published paths

func (*LinuxClient) PathExists

func (client *LinuxClient) PathExists(path string) bool

func (*LinuxClient) ReadMountProcInfo

func (client *LinuxClient) ReadMountProcInfo(ctx context.Context, mountpoint, sourceDevice, devicePath string) (*models.MountInfo, error)

ReadMountProcInfo tries the consistent read for the given mount information from the "/proc/self/mountinfo"

func (*LinuxClient) RemountDevice

func (client *LinuxClient) RemountDevice(ctx context.Context, mountpoint, options string) error

RemountDevice remounts the mountpoint with supplied mount options.

func (*LinuxClient) RemoveMountPoint

func (client *LinuxClient) RemoveMountPoint(ctx context.Context, mountPointPath string) error

RemoveMountPoint attempts to unmount and remove the directory of the mountPointPath. This method should be idempotent and safe to call again if it fails the first time.

func (*LinuxClient) Umount

func (client *LinuxClient) Umount(ctx context.Context, mountpoint string) error

Umount detaches from the supplied location.

func (*LinuxClient) UmountAndRemoveMountPoint

func (client *LinuxClient) UmountAndRemoveMountPoint(ctx context.Context, mountPoint string) error

UmountAndRemoveMountPoint unmounts and removes the mountPoint

func (*LinuxClient) UmountAndRemoveTemporaryMountPoint

func (client *LinuxClient) UmountAndRemoveTemporaryMountPoint(ctx context.Context, mountPath string) error

UmountAndRemoveTemporaryMountPoint unmounts and removes the temporaryMountDir

func (*LinuxClient) UmountSMBPath

func (client *LinuxClient) UmountSMBPath(ctx context.Context, mappingPath, target string) (err error)

UmountSMBPath is a dummy added for compilation on non-windows platform.

func (*LinuxClient) WindowsBindMount

func (client *LinuxClient) WindowsBindMount(ctx context.Context, source, target string, options []string) (err error)

WindowsBindMount is a dummy added for compilation on non-windows platform.

type Mount

type Mount interface {
	MountFilesystemForResize(ctx context.Context, devicePath, stagedTargetPath, mountOptions string) (string, error)
	AttachNFSVolume(ctx context.Context, name, mountpoint string, publishInfo *models.VolumePublishInfo) error
	AttachSMBVolume(ctx context.Context, name, mountpoint, username, password string, publishInfo *models.VolumePublishInfo) error
	// contains filtered or unexported methods
}

type SmbClient

type SmbClient interface {
	smb.SmbClient
}

SmbClient is a wrapper around the smb client to help generate mocks

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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