Documentation ¶
Overview ¶
Copyright (c) 2024 Seagate Technology LLC and/or its Affiliates
Index ¶
- func Connect(c *Connector) (string, error)
- func CreateDBEntry(tgtIQN, portal, iFace string, discoverySecrets, sessionSecrets Secrets) error
- func DeleteDBEntry(tgtIQN string) error
- func DeleteIFace(iface string) error
- func Disconnect(tgtIqn string, portals []string) error
- func DisconnectVolume(c Connector) error
- func Discoverydb(tp, iface string, discoverySecrets Secrets, chapDiscovery bool) error
- func EnableDebugLogging(writer io.Writer)
- func ExecWithTimeout(command string, args []string, timeout time.Duration) ([]byte, error)
- func FlushMultipathDevice(device string) error
- func GetSessions() (string, error)
- func GetSysDevicesFromMultipathDevice(device string) ([]string, error)
- func ISCSIRescan(tgtIQN string, lun int) error
- func ListInterfaces() ([]string, error)
- func Login(tgtIQN, portal string) error
- func Logout(tgtIQN string, portals []string) error
- func PersistConnector(c *Connector, filePath string) error
- func RemoveAndClear(device string) error
- func RemovePhysicalDevice(devices ...string) error
- func RescanISCSIDevices(hctls []HCTL) error
- func ResizeMultipathDevice(device string) error
- func ShowInterface(iface string) (string, error)
- type CmdError
- type Connector
- type HCTL
- type Secrets
- type TargetInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateDBEntry ¶
CreateDBEntry sets up a node entry for the specified tgt in the nodes iscsi nodes db
func DeleteDBEntry ¶
DeleteDBEntry deletes the iscsi db entry fo rthe specified target
func Disconnect ¶
Disconnect performs a disconnect operation on a volume
func DisconnectVolume ¶
DisconnectVolume removes a volume from a Linux host.
func Discoverydb ¶
Discoverydb discovers the iscsi target
func EnableDebugLogging ¶
EnableDebugLogging provides a mechanism to turn on debug logging for this package output is written to the provided io.Writer
func ExecWithTimeout ¶
func FlushMultipathDevice ¶
FlushMultipathDevice flushes a multipath device dm-x with command multipath -f /dev/dm-x
func GetSessions ¶
GetSessions retrieves a list of current iscsi sessions on the node
func GetSysDevicesFromMultipathDevice ¶
GetSysDevicesFromMultipathDevice gets all slaves for multipath device dm-x in /sys/block/dm-x/slaves/
func ISCSIRescan ¶ added in v1.1.0
ISCSIRescan takes a target iqn and lun and writes to the scan file in the scsi subsystem We do this manually instead of relying on iscsiadm -R. This prevents a race condition in which devices that are in the process of being removed can be re-discovered and left behind.
func ListInterfaces ¶
ListInterfaces returns a list of all iscsi interfaces configured on the node along with the raw output in Response.StdOut we add the convenience of returning a list of entries found
func Logout ¶
Logout logs out the specified target, if the target is not logged in it's not considered an error
func PersistConnector ¶
PersistConnector persists the provided Connector to the specified file (ie /var/lib/pfile/myConnector.json)
func RemoveAndClear ¶ added in v1.0.2
RemoveAndClear calls 'dmsetup' to remove and clear a device entry
func RemovePhysicalDevice ¶
RemovePhysicalDevice removes device(s) sdx from a Linux host.
func RescanISCSIDevices ¶ added in v1.1.0
func ResizeMultipathDevice ¶
ResizeMultipathDevice resize a multipath device based on its underlying devices
func ShowInterface ¶
ShowInterface retrieves the details for the specified iscsi interface caller should inspect r.Err and use r.StdOut for interface details
Types ¶
type CmdError ¶
CmdError is a custom error to provide details including the command, stderr output and exit code. iscsiadm in some cases requires all of this info to determine success or failure
type Connector ¶
type Connector struct { VolumeName string `json:"volume_name"` Targets []TargetInfo `json:"targets"` Lun int32 `json:"lun"` AuthType string `json:"auth_type"` DiscoverySecrets Secrets `json:"discovery_secrets"` SessionSecrets Secrets `json:"session_secrets"` Interface string `json:"interface"` Multipath bool `json:"multipath"` DevicePath string `json:"device_path"` // DevicePath is dm-x for a multipath device, and sdx for a normal device. RetryCount int32 `json:"retry_count"` CheckInterval int32 `json:"check_interval"` DoDiscovery bool `json:"do_discovery"` DoCHAPDiscovery bool `json:"do_chap_discovery"` TargetIqn string `json:"target_iqn"` TargetPortals []string `json:"target_portals"` }
Connector provides a struct to hold all of the needed parameters to make our iscsi connection
func GetConnectorFromFile ¶
GetConnectorFromFile attempts to create a Connector using the specified json file (ie /var/lib/pfile/myConnector.json)
type Secrets ¶
type Secrets struct { // SecretsType is the type of Secrets being utilized (currently we only impleemnent "chap" SecretsType string `json:"secretsType,omitempty"` // UserName is the configured iscsi user login UserName string `json:"userName"` // Password is the configured iscsi password Password string `json:"password"` // UserNameIn provides a specific input login for directional CHAP configurations UserNameIn string `json:"userNameIn,omitempty"` // PasswordIn provides a specific input password for directional CHAP configurations PasswordIn string `json:"passwordIn,omitempty"` }
Secrets provides optional iscsi security credentials (CHAP settings)