Documentation ¶
Index ¶
- Constants
- Variables
- type ISCSIConnectionState
- type ISCSINode
- type ISCSISession
- type ISCSISessionState
- type ISCSITarget
- type ISCSITransportName
- type ISCSIType
- type ISCSIinterface
- type LinuxISCSI
- func (iscsi *LinuxISCSI) CreateOrUpdateNode(target ISCSITarget, options map[string]string) error
- func (iscsi *LinuxISCSI) DeleteNode(target ISCSITarget) error
- func (iscsi *LinuxISCSI) DiscoverTargets(address string, login bool) ([]ISCSITarget, error)
- func (iscsi *LinuxISCSI) GetInitiators(filename string) ([]string, error)
- func (iscsi *LinuxISCSI) GetNodes() ([]ISCSINode, error)
- func (iscsi *LinuxISCSI) GetSessions() ([]ISCSISession, error)
- func (iscsi *LinuxISCSI) PerformLogin(target ISCSITarget) error
- func (iscsi *LinuxISCSI) PerformLogout(target ISCSITarget) error
- func (iscsi *LinuxISCSI) PerformRescan() error
- func (iscsi *LinuxISCSI) SetCHAPCredentials(target ISCSITarget, username, password string) error
- type MockISCSI
- func (iscsi *MockISCSI) CreateOrUpdateNode(target ISCSITarget, options map[string]string) error
- func (iscsi *MockISCSI) DeleteNode(target ISCSITarget) error
- func (iscsi *MockISCSI) DiscoverTargets(address string, login bool) ([]ISCSITarget, error)
- func (iscsi *MockISCSI) GetInitiators(filename string) ([]string, error)
- func (iscsi *MockISCSI) GetNodes() ([]ISCSINode, error)
- func (iscsi *MockISCSI) GetSessions() ([]ISCSISession, error)
- func (iscsi *MockISCSI) PerformLogin(target ISCSITarget) error
- func (iscsi *MockISCSI) PerformLogout(target ISCSITarget) error
- func (iscsi *MockISCSI) PerformRescan() error
- func (iscsi *MockISCSI) SetCHAPCredentials(target ISCSITarget, username, password string) error
Constants ¶
const ( // ChrootDirectory allows the iscsiadm commands to be run within a chrooted path, helpful for containerized services ChrootDirectory = "chrootDirectory" // DefaultInitiatorNameFile is the default file which contains the initiator names DefaultInitiatorNameFile = "/etc/iscsi/initiatorname.iscsi" // Timeout for iscsiadm command to execute Timeout = 30 )
const ( // MockNumberOfInitiators controls the number of initiators found in mock mode MockNumberOfInitiators = "numberOfInitiators" // MockNumberOfTargets controls the number of targets found in mock mode MockNumberOfTargets = "numberOfTargets" // MockNumberOfSessions controls the number of iSCIS sessions found in mock mode MockNumberOfSessions = "numberOfSession" // MockNumberOfNodes controls the number of iSCIS sessions found in mock mode MockNumberOfNodes = "numberOfNode" )
const ( ISCSISessionStateLOGGEDIN ISCSISessionState = "LOGGED_IN" ISCSISessionStateFAILED ISCSISessionState = "FAILED" ISCSISessionStateFREE ISCSISessionState = "FREE" ISCSIConnectionStateFREE ISCSIConnectionState = "FREE" ISCSIConnectionStateTRANSPORTWAIT ISCSIConnectionState = "TRANSPORT WAIT" ISCSIConnectionStateINLOGIN ISCSIConnectionState = "IN LOGIN" ISCSIConnectionStateLOGGEDIN ISCSIConnectionState = "LOGGED IN" ISCSIConnectionStateINLOGOUT ISCSIConnectionState = "IN LOGOUT" ISCSIConnectionStateLOGOUTREQUESTED ISCSIConnectionState = "LOGOUT REQUESTED" ISCSIConnectionStateCLEANUPWAIT ISCSIConnectionState = "CLEANUP WAIT" ISCSITransportNameTCP ISCSITransportName = "tcp" ISCSITransportNameISER ISCSITransportName = "iser" )
ISCSI session and connection states
Variables ¶
var ( // ErrIscsiNotInstalled is returned when the iscsi utilities are not // found on a system ErrIscsiNotInstalled = errors.New("iSCSI utilities are not installed") // ErrNotImplemented is returned when a platform does not implement ErrNotImplemented = errors.New("not implemented") )
var GOISCSIMock struct { InduceDiscoveryError bool InduceInitiatorError bool InduceLoginError bool InduceLogoutError bool InduceRescanError bool InduceGetSessionsError bool InduceGetNodesError bool InduceCreateOrUpdateNodeError bool InduceDeleteNodeError bool InduceSetCHAPError bool }
GOISCSIMock is a struct controlling induced errors
Functions ¶
This section is empty.
Types ¶
type ISCSIConnectionState ¶ added in v1.1.0
type ISCSIConnectionState string
ISCSIConnectionState holds iscsi connection state
type ISCSISession ¶ added in v1.1.0
type ISCSISession struct { Target string Portal string SID string IfaceTransport ISCSITransportName IfaceInitiatorname string IfaceIPaddress string ISCSISessionState ISCSISessionState ISCSIConnectionState ISCSIConnectionState Username string Password string UsernameIn string PasswordIn string }
ISCSISession defines an iSCSI session info
type ISCSISessionState ¶ added in v1.1.0
type ISCSISessionState string
ISCSISessionState holds iscsi session state
type ISCSITarget ¶
ISCSITarget defines an iSCSI target
type ISCSITransportName ¶ added in v1.1.0
type ISCSITransportName string
ISCSITransportName holds iscsi transport name
type ISCSIType ¶
type ISCSIType struct {
// contains filtered or unexported fields
}
ISCSIType is the base structre for each platform implementation
type ISCSIinterface ¶
type ISCSIinterface interface { // Discover the targets exposed via a given portal // returns an array of ISCSITarget instances DiscoverTargets(address string, login bool) ([]ISCSITarget, error) // Get a list of iSCSI initiators defined in a specified file // To use the system default file of "/etc/iscsi/initiatorname.iscsi", provide a filename of "" GetInitiators(filename string) ([]string, error) // Log into a specified target PerformLogin(target ISCSITarget) error // Log out of a specified target PerformLogout(target ISCSITarget) error // Rescan current iSCSI sessions PerformRescan() error // Query information about sessions GetSessions() ([]ISCSISession, error) // Query information about nodes GetNodes() ([]ISCSINode, error) // Set CHAP credentials for a target (creates/updates node database) SetCHAPCredentials(target ISCSITarget, username, password string) error // CreateOrUpdateNode creates new or update existing iSCSI node in iscsid database CreateOrUpdateNode(target ISCSITarget, options map[string]string) error // DeleteNode delete iSCSI node from iscsid database DeleteNode(target ISCSITarget) error // contains filtered or unexported methods }
ISCSIinterface is the interface that provides the iSCSI client functionality
type LinuxISCSI ¶
type LinuxISCSI struct { ISCSIType // contains filtered or unexported fields }
LinuxISCSI provides many iSCSI-specific functions.
func NewLinuxISCSI ¶
func NewLinuxISCSI(opts map[string]string) *LinuxISCSI
NewLinuxISCSI returns an LinuxISCSI client
func (*LinuxISCSI) CreateOrUpdateNode ¶ added in v1.1.0
func (iscsi *LinuxISCSI) CreateOrUpdateNode(target ISCSITarget, options map[string]string) error
CreateOrUpdateNode creates new or update existing iSCSI node in iscsid dm
func (*LinuxISCSI) DeleteNode ¶ added in v1.1.0
func (iscsi *LinuxISCSI) DeleteNode(target ISCSITarget) error
DeleteNode delete iSCSI node from iscsid database
func (*LinuxISCSI) DiscoverTargets ¶
func (iscsi *LinuxISCSI) DiscoverTargets(address string, login bool) ([]ISCSITarget, error)
DiscoverTargets runs an iSCSI discovery and returns a list of targets.
func (*LinuxISCSI) GetInitiators ¶
func (iscsi *LinuxISCSI) GetInitiators(filename string) ([]string, error)
GetInitiators returns a list of initiators on the local system.
func (*LinuxISCSI) GetNodes ¶ added in v1.1.0
func (iscsi *LinuxISCSI) GetNodes() ([]ISCSINode, error)
GetNodes will query information about nodes
func (*LinuxISCSI) GetSessions ¶ added in v1.1.0
func (iscsi *LinuxISCSI) GetSessions() ([]ISCSISession, error)
GetSessions will query information about sessions
func (*LinuxISCSI) PerformLogin ¶
func (iscsi *LinuxISCSI) PerformLogin(target ISCSITarget) error
PerformLogin will attempt to log into an iSCSI target
func (*LinuxISCSI) PerformLogout ¶
func (iscsi *LinuxISCSI) PerformLogout(target ISCSITarget) error
PerformLogout will attempt to log out of an iSCSI target
func (*LinuxISCSI) PerformRescan ¶
func (iscsi *LinuxISCSI) PerformRescan() error
PerformRescan will rescan targets known to current sessions
func (*LinuxISCSI) SetCHAPCredentials ¶ added in v1.2.0
func (iscsi *LinuxISCSI) SetCHAPCredentials(target ISCSITarget, username, password string) error
SetCHAPCredentials will set CHAP credentials
type MockISCSI ¶
type MockISCSI struct {
ISCSIType
}
MockISCSI provides a mock implementation of an iscsi client
func NewMockISCSI ¶
NewMockISCSI returns an mock ISCSI client
func (*MockISCSI) CreateOrUpdateNode ¶ added in v1.1.0
func (iscsi *MockISCSI) CreateOrUpdateNode(target ISCSITarget, options map[string]string) error
CreateOrUpdateNode creates new or update existing iSCSI node in iscsid database
func (*MockISCSI) DeleteNode ¶ added in v1.1.0
func (iscsi *MockISCSI) DeleteNode(target ISCSITarget) error
DeleteNode delete iSCSI node from iscsid database
func (*MockISCSI) DiscoverTargets ¶
func (iscsi *MockISCSI) DiscoverTargets(address string, login bool) ([]ISCSITarget, error)
DiscoverTargets runs an iSCSI discovery and returns a list of targets.
func (*MockISCSI) GetInitiators ¶
GetInitiators returns a list of initiators on the local system.
func (*MockISCSI) GetSessions ¶ added in v1.1.0
func (iscsi *MockISCSI) GetSessions() ([]ISCSISession, error)
GetSessions will query iSCSI session info
func (*MockISCSI) PerformLogin ¶
func (iscsi *MockISCSI) PerformLogin(target ISCSITarget) error
PerformLogin will attempt to log into an iSCSI target
func (*MockISCSI) PerformLogout ¶
func (iscsi *MockISCSI) PerformLogout(target ISCSITarget) error
PerformLogout will attempt to log out of an iSCSI target
func (*MockISCSI) PerformRescan ¶
PerformRescan will will rescan targets known to current sessions
func (*MockISCSI) SetCHAPCredentials ¶ added in v1.2.0
func (iscsi *MockISCSI) SetCHAPCredentials(target ISCSITarget, username, password string) error
SetCHAPCredentials will set CHAP credentials