Documentation
¶
Index ¶
- Constants
- type BlockVolumePathHandler
- type VolumePathHandler
- func (v VolumePathHandler) AttachFileDevice(ctx context.Context, path string) (string, error)
- func (v VolumePathHandler) AttachFileDeviceWithOffset(ctx context.Context, path string, offset int64) (string, error)
- func (v VolumePathHandler) DetachFileDevice(ctx context.Context, path string) error
- func (v VolumePathHandler) FindGlobalMapPathUUIDFromPod(ctx context.Context, pluginDir, mapPath string, podUID types.UID) (string, error)
- func (v VolumePathHandler) GetDeviceBindMountRefs(ctx context.Context, devPath string, mapPath string) ([]string, error)
- func (v VolumePathHandler) GetLoopDevice(ctx context.Context, path string) (string, error)
- func (v VolumePathHandler) IsDeviceBindMountExist(ctx context.Context, mapPath string) (bool, error)
- func (v VolumePathHandler) IsSymlinkExist(ctx context.Context, mapPath string) (bool, error)
- func (v VolumePathHandler) MapDevice(ctx context.Context, devicePath string, mapPath string, linkName string, ...) error
- func (v VolumePathHandler) RemoveMapPath(ctx context.Context, mapPath string) error
- func (v VolumePathHandler) UnmapDevice(ctx context.Context, mapPath string, linkName string, bindMount bool) error
Constants ¶
const ( ErrDeviceNotFound = "device not found" ErrDeviceNotSupported = "device not supported" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockVolumePathHandler ¶
type BlockVolumePathHandler interface { // MapDevice creates a symbolic link to block device under specified map path MapDevice(ctx context.Context, devicePath string, mapPath string, linkName string, bindMount bool) error // UnmapDevice removes a symbolic link to block device under specified map path UnmapDevice(ctx context.Context, mapPath string, linkName string, bindMount bool) error // RemovePath removes a file or directory on specified map path RemoveMapPath(ctx context.Context, mapPath string) error // IsSymlinkExist retruns true if specified symbolic link exists IsSymlinkExist(ctx context.Context, mapPath string) (bool, error) // IsDeviceBindMountExist retruns true if specified bind mount exists IsDeviceBindMountExist(ctx context.Context, mapPath string) (bool, error) // GetDeviceBindMountRefs searches bind mounts under global map path GetDeviceBindMountRefs(ctx context.Context, devPath string, mapPath string) ([]string, error) // FindGlobalMapPathUUIDFromPod finds {pod uuid} symbolic link under globalMapPath // corresponding to map path symlink, and then return global map path with pod uuid. FindGlobalMapPathUUIDFromPod(ctx context.Context, pluginDir, mapPath string, podUID types.UID) (string, error) // AttachFileDevice takes a path to a regular file and makes it available as an // attached block device. AttachFileDevice(ctx context.Context, path string) (string, error) // DetachFileDevice takes a path to the attached block device and // detach it from block device. DetachFileDevice(ctx context.Context, path string) error // GetLoopDevice returns the full path to the loop device associated with the given path. GetLoopDevice(ctx context.Context, path string) (string, error) }
BlockVolumePathHandler defines a set of operations for handling block volume-related operations
func NewBlockVolumePathHandler ¶
func NewBlockVolumePathHandler() BlockVolumePathHandler
NewBlockVolumePathHandler returns a new instance of BlockVolumeHandler.
type VolumePathHandler ¶
type VolumePathHandler struct { }
VolumePathHandler is path related operation handlers for block volume
func (VolumePathHandler) AttachFileDevice ¶
AttachFileDevice takes a path to a regular file and makes it available as an attached block device.
func (VolumePathHandler) AttachFileDeviceWithOffset ¶
func (v VolumePathHandler) AttachFileDeviceWithOffset(ctx context.Context, path string, offset int64) (string, error)
AttachFileDevice takes a path to a regular file and makes its content starting at the given offset available as an attached block device.
func (VolumePathHandler) DetachFileDevice ¶
func (v VolumePathHandler) DetachFileDevice(ctx context.Context, path string) error
DetachFileDevice takes a path to the attached block device and detach it from block device.
func (VolumePathHandler) FindGlobalMapPathUUIDFromPod ¶
func (v VolumePathHandler) FindGlobalMapPathUUIDFromPod(ctx context.Context, pluginDir, mapPath string, podUID types.UID) (string, error)
FindGlobalMapPathUUIDFromPod finds {pod uuid} bind mount under globalMapPath corresponding to map path symlink, and then return global map path with pod uuid. (See pkg/volume/volume.go for details on a global map path and a pod device map path.) ex. mapPath symlink: pods/{podUid}}/{DefaultKubeletVolumeDevicesDirName}/{escapeQualifiedPluginName}/{volumeName} -> /dev/sdX
globalMapPath/{pod uuid} bind mount: plugins/kubernetes.io/{PluginName}/{DefaultKubeletVolumeDevicesDirName}/{volumePluginDependentPath}/{pod uuid} -> /dev/sdX
func (VolumePathHandler) GetDeviceBindMountRefs ¶
func (v VolumePathHandler) GetDeviceBindMountRefs(ctx context.Context, devPath string, mapPath string) ([]string, error)
GetDeviceBindMountRefs searches bind mounts under global map path
func (VolumePathHandler) GetLoopDevice ¶
GetLoopDevice returns the full path to the loop device associated with the given path.
func (VolumePathHandler) IsDeviceBindMountExist ¶
func (v VolumePathHandler) IsDeviceBindMountExist(ctx context.Context, mapPath string) (bool, error)
IsDeviceBindMountExist returns true if specified file exists and the type is device. If file doesn't exist, or file exists but not device, return false with no error. On other cases, return false with error from Lstat().
func (VolumePathHandler) IsSymlinkExist ¶
IsSymlinkExist returns true if specified file exists and the type is symbolik link. If file doesn't exist, or file exists but not symbolic link, return false with no error. On other cases, return false with error from Lstat().
func (VolumePathHandler) MapDevice ¶
func (v VolumePathHandler) MapDevice(ctx context.Context, devicePath string, mapPath string, linkName string, bindMount bool) error
MapDevice creates a symbolic link to block device under specified map path
func (VolumePathHandler) RemoveMapPath ¶
func (v VolumePathHandler) RemoveMapPath(ctx context.Context, mapPath string) error
RemoveMapPath removes a file or directory on specified map path
func (VolumePathHandler) UnmapDevice ¶
func (v VolumePathHandler) UnmapDevice(ctx context.Context, mapPath string, linkName string, bindMount bool) error
UnmapDevice removes a symbolic link associated to block device under specified map path