Documentation
¶
Index ¶
- Constants
- Variables
- func SetLogger(customLogger Logger)
- func SetTracer(customTracer Tracer)
- type DevicePathAndNamespace
- type FCHBAInfo
- type Logger
- type MockNVMe
- func (nvme *MockNVMe) DeviceRescan(device string) error
- func (nvme *MockNVMe) DiscoverNVMeFCTargets(address string, login bool) ([]NVMeTarget, error)
- func (nvme *MockNVMe) DiscoverNVMeTCPTargets(address string, login bool) ([]NVMeTarget, error)
- func (nvme *MockNVMe) GetInitiators(filename string) ([]string, error)
- func (nvme *MockNVMe) GetNVMeDeviceData(_ string) (string, string, error)
- func (nvme *MockNVMe) GetSessions() ([]NVMESession, error)
- func (nvme *MockNVMe) ListNVMeDeviceAndNamespace() ([]DevicePathAndNamespace, error)
- func (nvme *MockNVMe) ListNVMeNamespaceID(_ []DevicePathAndNamespace) (map[DevicePathAndNamespace][]string, error)
- func (nvme *MockNVMe) NVMeDisconnect(target NVMeTarget) error
- func (nvme *MockNVMe) NVMeFCConnect(target NVMeTarget, duplicateConnect bool) error
- func (nvme *MockNVMe) NVMeTCPConnect(target NVMeTarget, duplicateConnect bool) error
- type NVMESession
- type NVMESessionState
- type NVMETransportName
- type NVMEinterface
- type NVMe
- func (nvme *NVMe) DeviceRescan(device string) error
- func (nvme *NVMe) DiscoverNVMeFCTargets(targetAddress string, login bool) ([]NVMeTarget, error)
- func (nvme *NVMe) DiscoverNVMeTCPTargets(address string, login bool) ([]NVMeTarget, error)
- func (nvme *NVMe) GetInitiators(filename string) ([]string, error)
- func (nvme *NVMe) GetNVMeDeviceData(path string) (string, string, error)
- func (nvme *NVMe) GetSessions() ([]NVMESession, error)
- func (nvme *NVMe) ListNVMeDeviceAndNamespace() ([]DevicePathAndNamespace, error)
- func (nvme *NVMe) ListNVMeNamespaceID(NVMeDeviceAndNamespace []DevicePathAndNamespace) (map[DevicePathAndNamespace][]string, error)
- func (nvme *NVMe) NVMeDisconnect(target NVMeTarget) error
- func (nvme *NVMe) NVMeFCConnect(target NVMeTarget, duplicateConnect bool) error
- func (nvme *NVMe) NVMeTCPConnect(target NVMeTarget, duplicateConnect bool) error
- type NVMeSessionParser
- type NVMeTarget
- type NVMeType
- type SubSysResponse
- type Tracer
Constants ¶
const ( // MockNumberOfInitiators controls the number of initiators found in mock mode MockNumberOfInitiators = "numberOfInitiators" // MockNumberOfTCPTargets controls the number of NVMeTCP targets found in mock mode MockNumberOfTCPTargets = "numberOfTCPTargets" // MockNumberOfFCTargets controls the number of NVMeFC targets found in mock mode MockNumberOfFCTargets = "numberOfFCTargets" // MockNumberOfSessions controls the number of NVMe sessions found in mock mode MockNumberOfSessions = "numberOfSession" // MockNumberOfNamespaceDevices controls the number of NVMe Namespace Devices found in mock mode MockNumberOfNamespaceDevices = "numberOfNamespaceDevices" )
const ( // ChrootDirectory allows the nvme commands to be run within a chrooted path, helpful for containerized services ChrootDirectory = "chrootDirectory" // NVMePort - port number NVMePort = "4420" // NVMeNoObjsFoundExitCode exit code indicates that no records/targets/sessions/portals // found to execute operation on NVMeNoObjsFoundExitCode = 21 )
const ( // NVMeTransportTypeTCP - Placeholder for NVMe Transport type TCP NVMeTransportTypeTCP = "tcp" // NVMeTransportTypeFC - Placeholder for NVMe Transport type FC NVMeTransportTypeFC = "fc" // NVMESessionStateLive indicates the NVMe connection state as live NVMESessionStateLive NVMESessionState = "live" // NVMESessionStateDeleting indicates the NVMe connection state as deleting NVMESessionStateDeleting NVMESessionState = "deleting" // NVMESessionStateConnecting indicates the NVMe connection state as connecting NVMESessionStateConnecting NVMESessionState = "connecting" // NVMETransportNameTCP indicates the NVMe protocol as tcp NVMETransportNameTCP NVMETransportName = "tcp" // NVMETransportNameFC indicates the NVMe protocol as fc NVMETransportNameFC NVMETransportName = "fc" // NVMETransportNameRDMA indicates the NVMe protocol as rdma NVMETransportNameRDMA NVMETransportName = "rdma" )
Variables ¶
var (
// DefaultInitiatorNameFile is the default file which contains the initiator nqn
DefaultInitiatorNameFile = "/etc/nvme/hostnqn"
)
var GONVMEMock struct { InduceDiscoveryError bool InduceInitiatorError bool InduceTCPLoginError bool InduceFCLoginError bool InduceLogoutError bool InduceGetSessionsError bool InducedNVMeDeviceAndNamespaceError bool InducedNVMeNamespaceIDError bool InducedNVMeDeviceDataError bool }
GONVMEMock is a struct controlling induced errors
Functions ¶
Types ¶
type DevicePathAndNamespace ¶
DevicePathAndNamespace defines the device path and namespace of a device
type MockNVMe ¶ added in v1.1.0
type MockNVMe struct {
NVMeType
}
MockNVMe provides a mock implementation of an NVMe client
func NewMockNVMe ¶ added in v1.1.0
NewMockNVMe - returns a mock NVMe client
func (*MockNVMe) DeviceRescan ¶ added in v1.9.0
DeviceRescan rescan the NVMe device
func (*MockNVMe) DiscoverNVMeFCTargets ¶ added in v1.1.0
func (nvme *MockNVMe) DiscoverNVMeFCTargets(address string, login bool) ([]NVMeTarget, error)
DiscoverNVMeFCTargets runs an NVMe discovery and returns a list of targets.
func (*MockNVMe) DiscoverNVMeTCPTargets ¶ added in v1.1.0
func (nvme *MockNVMe) DiscoverNVMeTCPTargets(address string, login bool) ([]NVMeTarget, error)
DiscoverNVMeTCPTargets runs an NVMe discovery and returns a list of targets.
func (*MockNVMe) GetInitiators ¶ added in v1.1.0
GetInitiators returns a list of NVMe initiators on the local system.
func (*MockNVMe) GetNVMeDeviceData ¶ added in v1.2.0
GetNVMeDeviceData returns the information (nguid and namespace) of an NVME device path
func (*MockNVMe) GetSessions ¶ added in v1.1.0
func (nvme *MockNVMe) GetSessions() ([]NVMESession, error)
GetSessions Queries NVMe session info
func (*MockNVMe) ListNVMeDeviceAndNamespace ¶ added in v1.2.0
func (nvme *MockNVMe) ListNVMeDeviceAndNamespace() ([]DevicePathAndNamespace, error)
ListNVMeDeviceAndNamespace returns the Device Paths and Namespace of each NVMe device and each output content
func (*MockNVMe) ListNVMeNamespaceID ¶ added in v1.2.0
func (nvme *MockNVMe) ListNVMeNamespaceID(_ []DevicePathAndNamespace) (map[DevicePathAndNamespace][]string, error)
ListNVMeNamespaceID returns the namespace IDs for each NVME device path
func (*MockNVMe) NVMeDisconnect ¶ added in v1.1.0
func (nvme *MockNVMe) NVMeDisconnect(target NVMeTarget) error
NVMeDisconnect will attempt to log out of an NVMe target
func (*MockNVMe) NVMeFCConnect ¶ added in v1.1.0
func (nvme *MockNVMe) NVMeFCConnect(target NVMeTarget, duplicateConnect bool) error
NVMeFCConnect will attempt to log into an NVMe target
func (*MockNVMe) NVMeTCPConnect ¶ added in v1.1.0
func (nvme *MockNVMe) NVMeTCPConnect(target NVMeTarget, duplicateConnect bool) error
NVMeTCPConnect will attempt to log into an NVMe target
type NVMESession ¶
type NVMESession struct {
Target string
Portal string
Name string
NVMESessionState NVMESessionState
NVMETransportName NVMETransportName
}
NVMESession defines an iSCSI session info
type NVMESessionState ¶
type NVMESessionState string
NVMESessionState defines the NVMe connection state
type NVMEinterface ¶
type NVMEinterface interface {
// DiscoverNVMeTCPTargets discovers the targets exposed via a given portal
// returns an array of NVMeTCP Target instances
DiscoverNVMeTCPTargets(address string, login bool) ([]NVMeTarget, error)
// DiscoverNVMeFCTargets discovers the targets exposed via a given portal
// returns an array of NVMeFC Target instances
DiscoverNVMeFCTargets(address string, login bool) ([]NVMeTarget, error)
// GetInitiators get a list of NVMe initiators defined in a specified file
// To use the system default file of "/etc/nvme/hostnqn", provide a filename of ""
GetInitiators(filename string) ([]string, error)
// NVMeTCPConnect connects into a specified NVMeTCP target
NVMeTCPConnect(target NVMeTarget, duplicateConnect bool) error
// NVMeFCConnect connects into a specified NVMeFC target
NVMeFCConnect(target NVMeTarget, duplicateConnect bool) error
// NVMeDisconnect disconnect from the specified NVMe target
NVMeDisconnect(target NVMeTarget) error
// ListNVMeDeviceAndNamespace returns the NVME Device Paths and Namespace of each of the NVME device
ListNVMeDeviceAndNamespace() ([]DevicePathAndNamespace, error)
// ListNVMeNamespaceID returns the namespace IDs for each NVME device path
ListNVMeNamespaceID(NVMeDeviceNamespace []DevicePathAndNamespace) (map[DevicePathAndNamespace][]string, error)
// GetNVMeDeviceData returns the information (nguid and namespace) of an NVME device path
GetNVMeDeviceData(path string) (string, string, error)
// GetSessions queries information about NVMe sessions
GetSessions() ([]NVMESession, error)
// DeviceRescan rescan the NVMe controller device
DeviceRescan(device string) error
// contains filtered or unexported methods
}
NVMEinterface is the interface that provides the NVMe client functionality
type NVMe ¶ added in v1.1.0
NVMe provides many nvme-specific functions
func (*NVMe) DeviceRescan ¶ added in v1.9.0
DeviceRescan rescan the NVMe controller device
func (*NVMe) DiscoverNVMeFCTargets ¶ added in v1.1.0
func (nvme *NVMe) DiscoverNVMeFCTargets(targetAddress string, login bool) ([]NVMeTarget, error)
DiscoverNVMeFCTargets - runs nvme discovery and returns a list of NVMeFC targets.
func (*NVMe) DiscoverNVMeTCPTargets ¶ added in v1.1.0
func (nvme *NVMe) DiscoverNVMeTCPTargets(address string, login bool) ([]NVMeTarget, error)
DiscoverNVMeTCPTargets - runs nvme discovery and returns a list of NVMeTCP targets.
func (*NVMe) GetInitiators ¶ added in v1.1.0
GetInitiators returns a list of initiators on the local system.
func (*NVMe) GetNVMeDeviceData ¶ added in v1.2.0
GetNVMeDeviceData returns the information (nguid and namespace) of an NVME device path
func (*NVMe) GetSessions ¶ added in v1.1.0
func (nvme *NVMe) GetSessions() ([]NVMESession, error)
GetSessions queries information about NVMe sessions
func (*NVMe) ListNVMeDeviceAndNamespace ¶ added in v1.2.0
func (nvme *NVMe) ListNVMeDeviceAndNamespace() ([]DevicePathAndNamespace, error)
ListNVMeDeviceAndNamespace returns the NVMe device paths and namespace of each of the NVMe device.
func (*NVMe) ListNVMeNamespaceID ¶ added in v1.2.0
func (nvme *NVMe) ListNVMeNamespaceID(NVMeDeviceAndNamespace []DevicePathAndNamespace) (map[DevicePathAndNamespace][]string, error)
ListNVMeNamespaceID returns the namespace IDs for each NVME device path
func (*NVMe) NVMeDisconnect ¶ added in v1.1.0
func (nvme *NVMe) NVMeDisconnect(target NVMeTarget) error
NVMeDisconnect will attempt to disconnect from a given nvme target
func (*NVMe) NVMeFCConnect ¶ added in v1.1.0
func (nvme *NVMe) NVMeFCConnect(target NVMeTarget, duplicateConnect bool) error
NVMeFCConnect will attempt to connect into a given NVMeFC target
func (*NVMe) NVMeTCPConnect ¶ added in v1.1.0
func (nvme *NVMe) NVMeTCPConnect(target NVMeTarget, duplicateConnect bool) error
NVMeTCPConnect will attempt to connect into a given NVMeTCP target
type NVMeSessionParser ¶
type NVMeSessionParser interface {
Parse([]byte) []NVMESession
}
NVMeSessionParser defines an NVMe session parser
type NVMeTarget ¶
type NVMeTarget struct {
Portal string // traddr
TargetNqn string // subnqn
TrType string // trtype
AdrFam string // adrfam
SubType string // subtype
Treq string // treq
PortID string // portid
TrsvcID string // trsvcid
SecType string // sectype
TargetType string // trtype
HostAdr string // host_traddr
}
NVMeTarget defines an NVMe target
type NVMeType ¶
type NVMeType struct {
// contains filtered or unexported fields
}
NVMeType is the base structure for each platform implementation
type SubSysResponse ¶ added in v1.8.0
type SubSysResponse struct {
HostNQN string `json:"HostNQN"`
HostID string `json:"HostID"`
Subsystems []subsystems `json:"Subsystems"`
}
SubSysResponse of subsystems.