Documentation
¶
Index ¶
- type FakeHostUtil
- func (hu *FakeHostUtil) DeviceOpened(pathname string) (bool, error)
- func (hu *FakeHostUtil) EvalHostSymlinks(pathname string) (string, error)
- func (hu *FakeHostUtil) GetDeviceNameFromMount(mounter mount.Interface, mountPath, pluginMountDir string) (string, error)
- func (hu *FakeHostUtil) GetFileType(pathname string) (FileType, error)
- func (hu *FakeHostUtil) GetMode(pathname string) (os.FileMode, error)
- func (hu *FakeHostUtil) GetOwner(pathname string) (int64, int64, error)
- func (hu *FakeHostUtil) GetSELinuxSupport(pathname string) (bool, error)
- func (hu *FakeHostUtil) MakeRShared(path string) error
- func (hu *FakeHostUtil) PathExists(pathname string) (bool, error)
- func (hu *FakeHostUtil) PathIsDevice(pathname string) (bool, error)
- type FileType
- type HostUtil
- func (hu *HostUtil) DeviceOpened(pathname string) (bool, error)
- func (hu *HostUtil) EvalHostSymlinks(pathname string) (string, error)
- func (hu *HostUtil) GetDeviceNameFromMount(mounter mount.Interface, mountPath, pluginMountDir string) (string, error)
- func (hu *(HostUtil)) GetFileType(pathname string) (FileType, error)
- func (hu *HostUtil) GetMode(pathname string) (os.FileMode, error)
- func (hu *HostUtil) GetOwner(pathname string) (int64, int64, error)
- func (hu *HostUtil) GetSELinuxSupport(pathname string) (bool, error)
- func (hu *HostUtil) MakeRShared(path string) error
- func (hu *HostUtil) PathExists(pathname string) (bool, error)
- func (hu *HostUtil) PathIsDevice(pathname string) (bool, error)
- type HostUtils
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FakeHostUtil ¶
type FakeHostUtil struct { MountPoints []mount.MountPoint Filesystem map[string]FileType // contains filtered or unexported fields }
FakeHostUtil is a fake HostUtils implementation for testing
func NewFakeHostUtil ¶
func NewFakeHostUtil(fs map[string]FileType) *FakeHostUtil
NewFakeHostUtil returns a struct that implements the HostUtils interface for testing TODO: no callers were initializing the struct with any MountPoints. Check if those are still being used by any callers and if MountPoints still need to be a part of the struct.
func (*FakeHostUtil) DeviceOpened ¶
func (hu *FakeHostUtil) DeviceOpened(pathname string) (bool, error)
DeviceOpened checks if block device referenced by pathname is in use by checking if is listed as a device in the in-memory mountpoint table.
func (*FakeHostUtil) EvalHostSymlinks ¶
func (hu *FakeHostUtil) EvalHostSymlinks(pathname string) (string, error)
EvalHostSymlinks returns the path name after evaluating symlinks. No-op for testing
func (*FakeHostUtil) GetDeviceNameFromMount ¶
func (hu *FakeHostUtil) GetDeviceNameFromMount(mounter mount.Interface, mountPath, pluginMountDir string) (string, error)
GetDeviceNameFromMount given a mount point, find the volume id
func (*FakeHostUtil) GetFileType ¶
func (hu *FakeHostUtil) GetFileType(pathname string) (FileType, error)
GetFileType checks for file/directory/socket/block/character devices. Defaults to Directory if otherwise unspecified.
func (*FakeHostUtil) GetMode ¶
func (hu *FakeHostUtil) GetMode(pathname string) (os.FileMode, error)
GetMode returns permissions of pathname. Not implemented for testing
func (*FakeHostUtil) GetOwner ¶
func (hu *FakeHostUtil) GetOwner(pathname string) (int64, int64, error)
GetOwner returns the integer ID for the user and group of the given path Not implemented for testing
func (*FakeHostUtil) GetSELinuxSupport ¶
func (hu *FakeHostUtil) GetSELinuxSupport(pathname string) (bool, error)
GetSELinuxSupport tests if pathname is on a mount that supports SELinux. Not implemented for testing
func (*FakeHostUtil) MakeRShared ¶
func (hu *FakeHostUtil) MakeRShared(path string) error
MakeRShared checks if path is shared and bind-mounts it as rshared if needed. No-op for testing
func (*FakeHostUtil) PathExists ¶
func (hu *FakeHostUtil) PathExists(pathname string) (bool, error)
PathExists checks if pathname exists.
func (*FakeHostUtil) PathIsDevice ¶
func (hu *FakeHostUtil) PathIsDevice(pathname string) (bool, error)
PathIsDevice always returns true
type FileType ¶
type FileType string
FileType enumerates the known set of possible file types.
const ( // FileTypeBlockDev defines a constant for the block device FileType. FileTypeBlockDev FileType = "BlockDevice" // FileTypeCharDev defines a constant for the character device FileType. FileTypeCharDev FileType = "CharDevice" // FileTypeDirectory defines a constant for the directory FileType. FileTypeDirectory FileType = "Directory" // FileTypeFile defines a constant for the file FileType. FileTypeFile FileType = "File" // FileTypeSocket defines a constant for the socket FileType. FileTypeSocket FileType = "Socket" // FileTypeUnknown defines a constant for an unknown FileType. FileTypeUnknown FileType = "" )
type HostUtil ¶
type HostUtil struct{}
HostUtil implements HostUtils for Windows platforms.
func NewHostUtil ¶
func NewHostUtil() *HostUtil
NewHostUtil returns a struct that implements HostUtils on Windows platforms
func (*HostUtil) DeviceOpened ¶
DeviceOpened determines if the device is in use elsewhere
func (*HostUtil) EvalHostSymlinks ¶
EvalHostSymlinks returns the path name after evaluating symlinks
func (*HostUtil) GetDeviceNameFromMount ¶
func (hu *HostUtil) GetDeviceNameFromMount(mounter mount.Interface, mountPath, pluginMountDir string) (string, error)
GetDeviceNameFromMount given a mnt point, find the device
func (*BADRECV) GetFileType ¶
GetFileType checks for sockets/block/character devices
func (*HostUtil) GetOwner ¶
GetOwner returns the integer ID for the user and group of the given path Note that on windows, it always returns 0. We actually don't set Group on windows platform, see SetVolumeOwnership implementation.
func (*HostUtil) GetSELinuxSupport ¶
GetSELinuxSupport returns a boolean indicating support for SELinux. Windows does not support SELinux.
func (*HostUtil) MakeRShared ¶
MakeRShared checks that given path is on a mount with 'rshared' mount propagation. Empty implementation here.
func (*HostUtil) PathExists ¶
PathExists checks whether the path exists
type HostUtils ¶
type HostUtils interface { // DeviceOpened determines if the device (e.g. /dev/sdc) is in use elsewhere // on the system, i.e. still mounted. DeviceOpened(pathname string) (bool, error) // PathIsDevice determines if a path is a device. PathIsDevice(pathname string) (bool, error) // GetDeviceNameFromMount finds the device name by checking the mount path // to get the global mount path within its plugin directory. GetDeviceNameFromMount(mounter mount.Interface, mountPath, pluginMountDir string) (string, error) // propagation. If not, it bind-mounts the path as rshared. MakeRShared(path string) error // GetFileType checks for file/directory/socket/block/character devices. GetFileType(pathname string) (FileType, error) // PathExists tests if the given path already exists // Error is returned on any other error than "file not found". PathExists(pathname string) (bool, error) // EvalHostSymlinks returns the path name after evaluating symlinks. EvalHostSymlinks(pathname string) (string, error) // GetOwner returns the integer ID for the user and group of the given path GetOwner(pathname string) (int64, int64, error) // GetSELinuxSupport returns true if given path is on a mount that supports // SELinux. GetSELinuxSupport(pathname string) (bool, error) // GetMode returns permissions of the path. GetMode(pathname string) (os.FileMode, error) }
HostUtils defines the set of methods for interacting with paths on a host.