Documentation ¶
Index ¶
- Constants
- func ConvertSizeToBytes(s string) (string, error)
- func EnsureIscsiSession(hostDataIP string) error
- func FormatVolume(device, fstype string) error
- func GetDeviceFileFromIscsiPath(iscsiPath string) (devFile string)
- func GetFSType(device string) string
- func GetInitiatorIqns() ([]string, error)
- func GetV(opts map[string]string, keys string, defaultValue string) string
- func GetVolumeSizeBytes(opts map[string]string, defaultVolumeSize string) (uint64, error)
- func IscsiDisableDelete(tgt *IscsiTargetInfo) (err error)
- func IscsiRescan() (err error)
- func IscsiSessionExists(portal string) (bool, error)
- func IscsiSupported() bool
- func IscsiadmCmd(args []string) ([]byte, error)
- func LoginIscsiTarget(iqn, portal string) error
- func LoginWithChap(tiqn, portal, username, password, iface string) error
- func Mount(device, mountpoint string) error
- func Multipath() (err error)
- func MultipathDetected() bool
- func MultipathFlush() (err error)
- func Pow(x int64, y int) int64
- func RandomString(str_size int) string
- func Stat(fileName string) (string, error)
- func UdevSettle() error
- func Umount(mountpoint string) error
- func WaitForPathToExist(fileName string, numTries int) bool
- type DFInfo
- type IscsiDiscoveryInfo
- type IscsiSessionInfo
- type IscsiTargetInfo
- type ScsiDeviceInfo
Constants ¶
const Darwin = "darwin"
Darwin is a constant value for the runtime.GOOS that represents Apple MacOS
const ISCSI_ERR_NO_OBJS_FOUND int = 21
const Linux = "linux"
Linux is a constant value for the runtime.GOOS that represents the Linux OS
const Windows = "windows"
Windows is a constant value for the runtime.GOOS that represents the Windows OS
Variables ¶
This section is empty.
Functions ¶
func ConvertSizeToBytes ¶
ConvertSizeToBytes converts size to bytes; see also https://en.wikipedia.org/wiki/Kilobyte
func EnsureIscsiSession ¶ added in v1.4.0
func FormatVolume ¶
FormatVolume creates a filesystem for the supplied device of the supplied type
func GetDeviceFileFromIscsiPath ¶
GetDeviceFileFromIscsiPath returns the /dev device for the supplied iscsiPath
func GetInitiatorIqns ¶
GetInitiatorIqns returns parsed contents of /etc/iscsi/initiatorname.iscsi
func GetV ¶
GetV takes a map, key(s), and a defaultValue; will return the value of the key or defaultValue if none is set. If keys is a string of key values separated by "|", then each key is tried in turn. This allows compatibility with deprecated values, i.e. "fstype|fileSystemType".
func GetVolumeSizeBytes ¶
GetVolumeSizeBytes determines the size, in bytes, of a volume from the "size" opt value. If "size" has a units suffix, that is handled here. If there are no units, the default is GiB. If size is not in opts, the specified default value is parsed identically and used instead.
func IscsiDisableDelete ¶
func IscsiDisableDelete(tgt *IscsiTargetInfo) (err error)
IscsiDisableDelete logout from the supplied target and remove the iSCSI device
func IscsiRescan ¶
func IscsiRescan() (err error)
IscsiRescan uses the 'rescan-scsi-bus' command to perform rescanning of the SCSI bus
func IscsiSessionExists ¶
IscsiSessionExists checks to see if a session exists to the sepecified portal
func IscsiSupported ¶
func IscsiSupported() bool
IscsiSupported returns true if iscsiadm is installed and in the PATH
func IscsiadmCmd ¶
IscsiadmCmd uses the 'iscsiadm' command to perform operations
func LoginIscsiTarget ¶ added in v1.4.0
Login to iSCSI target
func LoginWithChap ¶
LoginWithChap will login to the iSCSI target with the supplied credentials
func MultipathDetected ¶
func MultipathDetected() bool
MultipathDetected returns true if /sbin/multipath is installed and in the PATH
func MultipathFlush ¶
func MultipathFlush() (err error)
MultipathFlush invokes the 'multipath' commands to flush paths that have been removed
func Pow ¶
Pow is an integer version of exponentiation; existing builtin is float, we needed an int version.
func RandomString ¶
RandomString returns a string of the specified length consisting only of alphabetic characters.
func WaitForPathToExist ¶
WaitForPathToExist retries every second, up to numTries times, with increasing backoff, for the specified fileName to show up
Types ¶
type IscsiDiscoveryInfo ¶ added in v1.4.0
IscsiDiscoveryInfo contains information about discovered iSCSI targets
func IscsiDiscovery ¶
func IscsiDiscovery(portal string) ([]IscsiDiscoveryInfo, error)
IscsiDiscovery uses the 'iscsiadm' command to perform discovery
type IscsiSessionInfo ¶
IscsiSessionInfo contains information about iSCSI sessions
func GetIscsiSessionInfo ¶
func GetIscsiSessionInfo() ([]IscsiSessionInfo, error)
GetIscsiSessionInfo parses output from 'iscsiadm -m session' and returns the parsed output
type IscsiTargetInfo ¶
type IscsiTargetInfo struct { IP string Port string Portal string Iqn string Lun string Device string Discovery string }
IscsiTargetInfo structure for usage with the iscsiadm command
type ScsiDeviceInfo ¶
type ScsiDeviceInfo struct { Host string Channel string Target string LUN string Device string MultipathDevice string Filesystem string IQN string }
ScsiDeviceInfo contains information about SCSI devices
func GetDeviceInfoForLuns ¶
func GetDeviceInfoForLuns() ([]ScsiDeviceInfo, error)
GetDeviceInfoForLuns parses 'lsscsi' to find NetApp LUNs
func LsscsiCmd ¶
func LsscsiCmd(args []string) ([]ScsiDeviceInfo, error)
LsscsiCmd executes and parses the output from the 'lsscsi' command