iscsi

package
v0.0.0-...-f37bb2f Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

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

This section is empty.

Types

type Interface

type Interface interface {
	// AddToDB adds the iSCSI node record for the target.
	AddToDB() error

	// DeviceOpened determines if the device is in use elsewhere
	// on the system, i.e. still mounted.
	DeviceOpened(pathname string) (bool, 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

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

	// Logout logs out the iSCSI target.
	Logout() 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
}

Interface mounts iSCSI voumes.

func New

func New(iqn, ipv4 string, port int) Interface

New creates a new iSCSI handler.

func NewFromDevicePath

func NewFromDevicePath(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 NewFromMountPointPath

func NewFromMountPointPath(mountPath string) (Interface, error)

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

Jump to

Keyboard shortcuts

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