nsenter

package
v1.15.8-beta.1 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mounter

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

Mounter implements mount.Interface Currently, all docker containers receive their own mount namespaces. Mounter works by executing nsenter to run commands in the host's mount namespace.

func NewMounter

func NewMounter(rootDir string, ne *nsenter.Nsenter) *Mounter

NewMounter creates a new mounter for kubelet that runs as a container.

func (*Mounter) DeviceOpened

func (n *Mounter) DeviceOpened(pathname string) (bool, error)

DeviceOpened checks if block device in use by calling Open with O_EXCL flag. Returns true if open returns errno EBUSY, and false if errno is nil. Returns an error if errno is any error other than EBUSY. Returns with error if pathname is not a device.

func (n *Mounter) EvalHostSymlinks(pathname string) (string, error)

EvalHostSymlinks returns the path name after evaluating symlinks.

func (*Mounter) ExistsPath

func (n *Mounter) ExistsPath(pathname string) (bool, error)

ExistsPath checks if pathname exists. Error is returned on any other error than "file not found".

func (*Mounter) GetDeviceNameFromMount

func (n *Mounter) GetDeviceNameFromMount(mountPath, pluginMountDir string) (string, error)

GetDeviceNameFromMount given a mount point, find the volume id from checking /proc/mounts

func (*Mounter) GetFSGroup

func (n *Mounter) GetFSGroup(pathname string) (int64, error)

GetFSGroup returns FSGroup of pathname.

func (*Mounter) GetFileType

func (n *Mounter) GetFileType(pathname string) (mount.FileType, error)

GetFileType checks for file/directory/socket/block/character devices.

func (*Mounter) GetMode

func (n *Mounter) GetMode(pathname string) (os.FileMode, error)

GetMode returns permissions of pathname.

func (*Mounter) GetMountRefs

func (n *Mounter) GetMountRefs(pathname string) ([]string, error)

GetMountRefs finds all mount references to the path, returns a list of paths. Path could be a mountpoint path, device or a normal directory (for bind mount).

func (*Mounter) GetSELinuxSupport

func (n *Mounter) GetSELinuxSupport(pathname string) (bool, error)

GetSELinuxSupport tests if pathname is on a mount that supports SELinux.

func (*Mounter) IsLikelyNotMountPoint

func (n *Mounter) IsLikelyNotMountPoint(file string) (bool, error)

IsLikelyNotMountPoint determines whether a path is a mountpoint by calling findmnt in the host's root mount namespace.

func (*Mounter) IsMountPointMatch

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

IsMountPointMatch tests if dir and mp are the same path

func (*Mounter) List

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

List returns a list of all mounted filesystems in the host's mount namespace.

func (*Mounter) MakeDir

func (n *Mounter) MakeDir(pathname string) error

MakeDir creates a new directory.

func (*Mounter) MakeFile

func (n *Mounter) MakeFile(pathname string) error

MakeFile creates an empty file.

func (*Mounter) MakeRShared

func (n *Mounter) MakeRShared(path string) error

MakeRShared checks if path is shared and bind-mounts it as rshared if needed.

func (*Mounter) Mount

func (n *Mounter) Mount(source string, target string, fstype string, options []string) error

Mount runs mount(8) in the host's root mount namespace. Aside from this aspect, Mount has the same semantics as the mounter returned by mount.New()

func (*Mounter) PathIsDevice

func (n *Mounter) PathIsDevice(pathname string) (bool, error)

PathIsDevice uses FileInfo returned from os.Stat to check if path refers to a device.

func (*Mounter) Unmount

func (n *Mounter) Unmount(target string) error

Unmount runs umount(8) in the host's mount namespace.

Jump to

Keyboard shortcuts

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