Documentation
¶
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(targetIqn string, targets []string)
- func Discoverydb(tp, iface string, discoverySecrets Secrets, chapDiscovery bool) error
- func ExecWithTimeout(command string, args []string, timeout time.Duration) ([]byte, error)
- func FlushMultipathDevice(device *Device) error
- func GetSessions() (string, error)
- func ListInterfaces() ([]string, error)
- func Login(tgtIQN, portal string) error
- func Logout(tgtIQN, portal string) error
- func PersistConnector(c *Connector, filePath string) error
- func RemoveSCSIDevices(devices ...Device) error
- func ResizeMultipathDevice(device *Device) error
- func ShowInterface(iface string) (string, error)
- type Connector
- type Device
- func (d *Device) Delete() error
- func (d *Device) Exists() error
- func (d *Device) GetPath() string
- func (d *Device) HCTL() (*HCTL, error)
- func (d *Device) Rescan() error
- func (d *Device) Shutdown() error
- func (d *Device) WWID() (string, error)
- func (d *Device) WriteDeviceFile(name string, content string) error
- type HCTL
- type Secrets
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 for the specified target
func Disconnect ¶
Disconnect is for backward-compatibility with c.Disconnect()
func Discoverydb ¶
Discoverydb discovers the iscsi target
func ExecWithTimeout ¶
ExecWithTimeout execute a command with a timeout and returns an error if timeout is exceeded
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 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 PersistConnector ¶
PersistConnector is for backward-compatibility with c.Persist()
func RemoveSCSIDevices ¶
RemoveSCSIDevices removes SCSI device(s) from a Linux host.
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 Connector ¶
type Connector struct { VolumeName string `json:"volume_name"` TargetIqn string `json:"target_iqn"` TargetPortals []string `json:"target_portal"` Lun int32 `json:"lun"` AuthType string `json:"auth_type"` DiscoverySecrets Secrets `json:"discovery_secrets"` SessionSecrets Secrets `json:"session_secrets"` Interface string `json:"interface"` MountTargetDevice *Device `json:"mount_target_device"` Devices []Device `json:"devices"` RetryCount uint `json:"retry_count"` CheckInterval uint `json:"check_interval"` DoDiscovery bool `json:"do_discovery"` DoCHAPDiscovery bool `json:"do_chap_discovery"` }
Connector provides a struct to hold all 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)
func (*Connector) Connect ¶
Connect attempts to connect a volume to this node using the provided Connector info
func (*Connector) Disconnect ¶
func (c *Connector) Disconnect()
Disconnect performs a disconnect operation from an appliance. Be sure to disconnect all devices properly before doing this as it can result in data loss.
func (*Connector) DisconnectVolume ¶
DisconnectVolume removes a volume from a Linux host.
func (*Connector) IsMultipathConsistent ¶
IsMultipathConsistent check if the currently used device is using a consistent multipath mapping
func (*Connector) IsMultipathEnabled ¶
IsMultipathEnabled check if multipath is enabled on devices handled by this connector
type Device ¶
type Device struct { Name string `json:"name"` Hctl string `json:"hctl"` Children []Device `json:"children"` Type string `json:"type"` Transport string `json:"tran"` Size string `json:"size,omitempty"` }
Device contains information about a device
func GetISCSIDevices ¶
GetISCSIDevices get iSCSI devices from device paths It will returns all iSCSI devices if no paths are given
func GetSCSIDevices ¶
GetSCSIDevices get SCSI devices from device paths It will returns all SCSI devices if no paths are given
func (*Device) Delete ¶
Delete detach an SCSI device by writing 1 in /sys/class/scsi_device/h:c:t:l/device/delete
func (*Device) Exists ¶
Exists check if the device exists at its path and returns an error otherwise
func (*Device) Rescan ¶
Rescan does a rescan of SCSI device by writing 1 in /sys/class/scsi_device/h:c:t:l/device/rescan
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)