disk

package
v1.24.1 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// ISCSIDEVICE is the map key to get or save iscci device
	ISCSIDEVICE = "iscsi_device"
	// ISCSIIQN is the map key to get or save iSCSI IQN
	ISCSIIQN = "iscci_iqn"
	// ISCSIIP is the map key to get or save iSCSI IP
	ISCSIIP = "iscsi_ip"
	// ISCSIPORT is the map key to get or save iSCSI Port
	ISCSIPORT = "iscsi_port"
)
View Source
const (
	EncryptedUmountCommand = "umount.oci-fss"
)

Variables

View Source
var ErrMountPointNotFound = errors.New("mount point not found")

ErrMountPointNotFound is returned when a given path does not appear to be a mount point.

Functions

func FindFromDevicePath

func FindFromDevicePath(logger *zap.SugaredLogger, mountDevice string) ([]string, error)

FindFromDevicePath extracts the IQN, IPv4 address, and port from a iSCSI mount device path. i.e. /dev/disk/by-path/ip-<ip>:<port>-iscsi-<IQN>-lun-1

func FindFromMountPointPath

func FindFromMountPointPath(logger *zap.SugaredLogger, diskByPaths []string) ([]string, error)

FindFromMountPointPath gets /dev/disk/by-path/ip-<ip>:<port>-iscsi-<IQN>-lun-1 from the given mount point path.

func GetDiskPathFromMountPath

func GetDiskPathFromMountPath(logger *zap.SugaredLogger, mountPath string) ([]string, error)

GetDiskPathFromMountPath resolves a directory to a block device

func UnmountPath added in v1.24.0

func UnmountPath(logger *zap.SugaredLogger, mountPath string, mounter mount.Interface) error

UnmountPath is a common unmount routine that unmounts the given path and deletes the remaining directory if successful.

func UnmountWithEncrypt added in v1.24.0

func UnmountWithEncrypt(logger *zap.SugaredLogger, target string) error

Unmount the target that is in-transit encryption enabled

func WaitForDirectoryDeletion added in v1.24.0

func WaitForDirectoryDeletion(logger *zap.SugaredLogger, mountPath string) error

Types

type Disk

type Disk struct {
	IQN  string
	IPv4 string
	Port int
}

Disk interface

func (*Disk) String

func (sd *Disk) String() string

func (*Disk) Target

func (sd *Disk) Target() string

Target returns the target to connect to in the format ip:port.

type Interface

type Interface interface {
	// AddToDB adds the iSCSI node record for the target.
	AddToDB() error
	// FormatAndMount formats the given disk, if needed, and mounts it.  That is
	// if the disk is not formatted and it is not being mounted as read-only it
	// will format it first then mount it. Otherwise, if the disk is already
	// formatted or it is being mounted as read-only, it will be mounted without
	// formatting.
	FormatAndMount(source string, target string, fstype string, options []string) error

	//Mount only mounts the disk. In case if formatting is handled by different functionality.
	// This function doesn't bother for checking the format again.
	Mount(source string, target string, fstype string, options []string) error

	// Login logs into the iSCSI target.
	Login() error

	// Logout logs out the iSCSI target.
	Logout() error

	DeviceOpened(pathname string) (bool, error)
	// updates the queue depth for iSCSI target
	UpdateQueueDepth() error

	// RemoveFromDB removes the iSCSI target from the database.
	RemoveFromDB() error

	// SetAutomaticLogin sets the iSCSI node to automatically login at machine
	// start-up.
	SetAutomaticLogin() error

	// UnmountPath is a common unmount routine that unmounts the given path and
	// deletes the remaining directory if successful.
	UnmountPath(path string) error

	Resize(devicePath string, volumePath string) (bool, error)
}

Interface mounts iSCSI voumes.

func New

func New(logger *zap.SugaredLogger, iqn, ipv4 string, port int) Interface

New creates a new iSCSI handler.

func NewFromDevicePath

func NewFromDevicePath(logger *zap.SugaredLogger, mountDevice string) (Interface, error)

NewFromDevicePath extracts the IQN, IPv4 address, and port from a iSCSI mount device path. i.e. /dev/disk/by-path/ip-<ip>:<port>-iscsi-<IQN>-lun-1

func NewFromISCSIDisk

func NewFromISCSIDisk(logger *zap.SugaredLogger, sd *Disk) Interface

NewFromISCSIDisk creates a new iSCSI handler from ISCSIDisk.

func NewFromMountPointPath

func NewFromMountPointPath(logger *zap.SugaredLogger, mountPath string) (Interface, error)

NewFromMountPointPath gets /dev/disk/by-path/ip-<ip>:<port>-iscsi-<IQN>-lun-1 from the given mount point path.

func NewFromPVDisk

func NewFromPVDisk(logger *zap.SugaredLogger) Interface

NewFromPVDisk creates a new PV handler from PVDisk.

Jump to

Keyboard shortcuts

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