device_connectivity

package
v1.11.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 13, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DevPath                     = "/dev"
	DevMapperPath               = "/dev/mapper"
	WaitForMpathRetries         = 5
	WaitForMpathWaitIntervalSec = 1
	FcHostSysfsPath             = "/sys/class/fc_remote_ports/rport-*/port_name"
	IscsiHostRexExPath          = "/sys/class/iscsi_host/host*/device/session*/iscsi_session/session*/targetname"

	WwnOuiEnd              = 7
	WwnVendorIdentifierEnd = 16
)
View Source
const (
	IscsiCmdTimeout = 30 * time.Second

	ISCSIErrNoObjsFound = 21
)

Variables

View Source
var (
	TimeOutMultipathCmd                     = 60 * 1000
	TimeOutMultipathdCmd                    = 10 * 1000
	TimeOutBlockDevCmd                      = 10 * 1000
	TimeOutSgInqCmd                         = 3 * 1000
	MultipathdWildcardsVolumeIdAndMpath     = []string{"%w", "%d"}
	MultipathdWildcardsMpathNameAndVolumeId = []string{"%n", "%w"}
)

Functions

This section is empty.

Types

type ConnectivityIdentifierStorageTargetNotFoundError added in v0.9.0

type ConnectivityIdentifierStorageTargetNotFoundError struct {
	StorageTargetName string
	DirectoryPath     string
}

func (*ConnectivityIdentifierStorageTargetNotFoundError) Error added in v0.9.0

type ErrorNoRegexWwnMatchInScsiInq added in v1.3.0

type ErrorNoRegexWwnMatchInScsiInq struct {
	// contains filtered or unexported fields
}

func (*ErrorNoRegexWwnMatchInScsiInq) Error added in v1.3.0

type ErrorNotFoundArrayIdentifiers added in v0.9.0

type ErrorNotFoundArrayIdentifiers struct {
	// contains filtered or unexported fields
}

func (*ErrorNotFoundArrayIdentifiers) Error added in v0.9.0

type ErrorNothingWasWrittenToScanFileError

type ErrorNothingWasWrittenToScanFileError struct {
	// contains filtered or unexported fields
}

func (*ErrorNothingWasWrittenToScanFileError) Error

type ErrorWrongDeviceFound added in v1.3.0

type ErrorWrongDeviceFound struct {
	DevPath       string
	DmVolumeId    string
	SgInqVolumeId string
}

func (*ErrorWrongDeviceFound) Error added in v1.3.0

func (e *ErrorWrongDeviceFound) Error() string

type GetDmsPathHelperGeneric added in v1.3.0

type GetDmsPathHelperGeneric struct {
	// contains filtered or unexported fields
}

func (GetDmsPathHelperGeneric) ExtractDmFieldValues added in v1.10.0

func (o GetDmsPathHelperGeneric) ExtractDmFieldValues(dmFilterValues []string, mpathdOutput string) map[string]bool

func (GetDmsPathHelperGeneric) ExtractVolumeId added in v1.10.0

func (o GetDmsPathHelperGeneric) ExtractVolumeId(mpathDeviceName string, mpathdOutput string) (string, error)

func (GetDmsPathHelperGeneric) GetFullDmPath added in v1.10.0

func (GetDmsPathHelperGeneric) GetFullDmPath(dms map[string]bool, volumeId string) (string, error)

func (GetDmsPathHelperGeneric) GetMpathDeviceNameFromProcMounts added in v1.10.0

func (GetDmsPathHelperGeneric) GetMpathDeviceNameFromProcMounts(procMounts string, volumePath string) (string, error)

func (GetDmsPathHelperGeneric) IsIndicatorMatchesFilterValues added in v1.10.0

func (o GetDmsPathHelperGeneric) IsIndicatorMatchesFilterValues(dmFilterValues []string, indicatorValue string) bool

func (GetDmsPathHelperGeneric) WaitForDmToExist added in v1.3.0

func (o GetDmsPathHelperGeneric) WaitForDmToExist(volumeIdVariations []string, maxRetries int, intervalSeconds int,
	multipathdCommandFormatArgs []string) (string, error)

type GetDmsPathHelperInterface added in v1.3.0

type GetDmsPathHelperInterface interface {
	WaitForDmToExist(volumeIdVariations []string, maxRetries int, intervalSeconds int, multipathdCommandFormatArgs []string) (string, error)
	ExtractDmFieldValues(dmFilterValues []string, mpathdOutput string) map[string]bool
	GetFullDmPath(dms map[string]bool, volumeId string) (string, error)
	IsIndicatorMatchesFilterValues(dmFilterValues []string, dmFieldValue string) bool
	GetMpathDeviceNameFromProcMounts(procMounts string, volumePath string) (string, error)
	ExtractVolumeId(mpathDeviceName string, mpathdOutput string) (string, error)
}

func NewGetDmsPathHelperGeneric added in v1.3.0

func NewGetDmsPathHelperGeneric(executer executer.ExecuterInterface) GetDmsPathHelperInterface

type MultipathDeviceNotFoundForVolumeError added in v1.3.0

type MultipathDeviceNotFoundForVolumeError struct {
	VolumeId string
}

func (*MultipathDeviceNotFoundForVolumeError) Error added in v1.3.0

type MultipathDeviceNotFoundForVolumePathError added in v1.10.0

type MultipathDeviceNotFoundForVolumePathError struct {
	VolumePath string
}

func (*MultipathDeviceNotFoundForVolumePathError) Error added in v1.10.0

type MultipleDeviceNotFoundError

type MultipleDeviceNotFoundError struct {
	DiskByPathDevice     string
	LinkToPhysicalDevice string
}

func (*MultipleDeviceNotFoundError) Error

type MultipleDmFieldValuesError added in v1.10.0

type MultipleDmFieldValuesError struct {
	Validator     string
	DmFieldValues map[string]bool
}

func (*MultipleDmFieldValuesError) Error added in v1.10.0

type OsDeviceConnectivityFc added in v0.9.0

type OsDeviceConnectivityFc struct {
	Executer          executer.ExecuterInterface
	HelperScsiGeneric OsDeviceConnectivityHelperScsiGenericInterface
}

func (OsDeviceConnectivityFc) EnsureLogin added in v1.1.0

func (r OsDeviceConnectivityFc) EnsureLogin(_ map[string][]string)

func (OsDeviceConnectivityFc) FlushMultipathDevice added in v0.9.0

func (r OsDeviceConnectivityFc) FlushMultipathDevice(mpathDevice string) error

func (OsDeviceConnectivityFc) GetMpathDevice added in v0.9.0

func (r OsDeviceConnectivityFc) GetMpathDevice(volumeId string) (string, error)

func (OsDeviceConnectivityFc) RemovePhysicalDevice added in v0.9.0

func (r OsDeviceConnectivityFc) RemovePhysicalDevice(sysDevices []string) error

func (OsDeviceConnectivityFc) RescanDevices added in v0.9.0

func (r OsDeviceConnectivityFc) RescanDevices(lunId int, arrayIdentifiers []string) error

func (OsDeviceConnectivityFc) ValidateLun added in v1.9.0

func (r OsDeviceConnectivityFc) ValidateLun(lun int, sysDevices []string) error

type OsDeviceConnectivityHelperGeneric added in v0.9.0

type OsDeviceConnectivityHelperGeneric struct {
	Executer executer.ExecuterInterface
	Helper   GetDmsPathHelperInterface
}

func (OsDeviceConnectivityHelperGeneric) GetDmsPath added in v1.3.0

func (o OsDeviceConnectivityHelperGeneric) GetDmsPath(volumeIdVariations []string) (string, error)

func (OsDeviceConnectivityHelperGeneric) GetHostsIdByArrayIdentifier added in v0.9.0

func (o OsDeviceConnectivityHelperGeneric) GetHostsIdByArrayIdentifier(arrayIdentifier string) ([]int, error)

func (OsDeviceConnectivityHelperGeneric) GetMpathDeviceName added in v1.10.0

func (o OsDeviceConnectivityHelperGeneric) GetMpathDeviceName(volumePath string) (string, error)

func (OsDeviceConnectivityHelperGeneric) GetMpathVolumeId added in v1.10.0

func (o OsDeviceConnectivityHelperGeneric) GetMpathVolumeId(mpathdOutput string, mpathDeviceName string,
	dmDirectory string) (string, error)

func (OsDeviceConnectivityHelperGeneric) GetMpathdOutputForVolume added in v1.10.0

func (o OsDeviceConnectivityHelperGeneric) GetMpathdOutputForVolume(volumeIdVariations []string,
	multipathdCommandFormatArgs []string) (string, error)

func (OsDeviceConnectivityHelperGeneric) GetVolumeIdVariations added in v1.10.0

func (OsDeviceConnectivityHelperGeneric) GetVolumeIdVariations(volumeUuid string) []string

func (OsDeviceConnectivityHelperGeneric) GetWwnByScsiInq added in v1.3.0

func (o OsDeviceConnectivityHelperGeneric) GetWwnByScsiInq(dev string) (string, error)

func (OsDeviceConnectivityHelperGeneric) IsAnyVariationInMpathVolumeId added in v1.10.0

func (o OsDeviceConnectivityHelperGeneric) IsAnyVariationInMpathVolumeId(mpathVolumeId string, volumeIdVariations []string) bool

func (OsDeviceConnectivityHelperGeneric) IsDmName added in v1.11.0

func (o OsDeviceConnectivityHelperGeneric) IsDmName(mpathDeviceName string) bool

func (OsDeviceConnectivityHelperGeneric) ReloadMultipath added in v1.3.0

func (o OsDeviceConnectivityHelperGeneric) ReloadMultipath() error

type OsDeviceConnectivityHelperInterface added in v0.9.0

type OsDeviceConnectivityHelperInterface interface {
	/*
		This is helper interface for OsDeviceConnectivityScsiGeneric.
		Mainly for writting clean unit testing, so we can Mock this interface in order to unit test OsDeviceConnectivityHelperGeneric logic.
	*/
	GetHostsIdByArrayIdentifier(arrayIdentifier string) ([]int, error)
	GetDmsPath(volumeIdVariations []string) (string, error)
	GetWwnByScsiInq(dev string) (string, error)
	ReloadMultipath() error
	GetMpathdOutputForVolume(volumeIdVariations []string, multipathdCommandFormatArgs []string) (string, error)
	GetVolumeIdVariations(volumeUuid string) []string
	GetMpathDeviceName(volumePath string) (string, error)
	IsAnyVariationInMpathVolumeId(mpathVolumeId string, volumeIdVariations []string) bool
	GetMpathVolumeId(mpathdOutput string, mpathDeviceName string, dmDirectory string) (string, error)
	IsDmName(mpathDeviceName string) bool
}

func NewOsDeviceConnectivityHelperGeneric added in v0.9.0

func NewOsDeviceConnectivityHelperGeneric(executer executer.ExecuterInterface) OsDeviceConnectivityHelperInterface

type OsDeviceConnectivityHelperScsiGeneric added in v0.9.0

type OsDeviceConnectivityHelperScsiGeneric struct {
	Executer        executer.ExecuterInterface
	Helper          OsDeviceConnectivityHelperInterface
	MutexMultipathF *sync.Mutex
}

func (OsDeviceConnectivityHelperScsiGeneric) FlushMultipathDevice added in v0.9.0

func (r OsDeviceConnectivityHelperScsiGeneric) FlushMultipathDevice(mpathDevice string) error

func (OsDeviceConnectivityHelperScsiGeneric) GetMpathDevice added in v0.9.0

func (r OsDeviceConnectivityHelperScsiGeneric) GetMpathDevice(volumeId string) (string, error)

func (OsDeviceConnectivityHelperScsiGeneric) IsVolumePathMatchesVolumeId added in v1.10.0

func (r OsDeviceConnectivityHelperScsiGeneric) IsVolumePathMatchesVolumeId(volumeUuid string, volumePath string) (bool, error)

func (OsDeviceConnectivityHelperScsiGeneric) RemovePhysicalDevice added in v0.9.0

func (r OsDeviceConnectivityHelperScsiGeneric) RemovePhysicalDevice(sysDevices []string) error

func (OsDeviceConnectivityHelperScsiGeneric) RescanDevices added in v0.9.0

func (r OsDeviceConnectivityHelperScsiGeneric) RescanDevices(lunId int, arrayIdentifiers []string) error

func (OsDeviceConnectivityHelperScsiGeneric) ValidateLun added in v1.9.0

func (r OsDeviceConnectivityHelperScsiGeneric) ValidateLun(lun int, sysDevices []string) error

type OsDeviceConnectivityHelperScsiGenericInterface added in v0.9.0

type OsDeviceConnectivityHelperScsiGenericInterface interface {
	/*
		This is helper interface for OsDeviceConnectivityHelperScsiGenericInterface.
		Mainly for writing clean unit testing, so we can Mock this interface in order to unit test logic.
	*/
	RescanDevices(lunId int, arrayIdentifiers []string) error
	GetMpathDevice(volumeId string) (string, error)
	FlushMultipathDevice(mpathDevice string) error
	RemovePhysicalDevice(sysDevices []string) error
	ValidateLun(lun int, sysDevices []string) error
	IsVolumePathMatchesVolumeId(volumeId string, volumePath string) (bool, error)
}

func NewOsDeviceConnectivityHelperScsiGeneric added in v0.9.0

func NewOsDeviceConnectivityHelperScsiGeneric(executer executer.ExecuterInterface) OsDeviceConnectivityHelperScsiGenericInterface

type OsDeviceConnectivityInterface

type OsDeviceConnectivityInterface interface {
	EnsureLogin(ipsByArrayIdentifier map[string][]string)    // For iSCSI login
	RescanDevices(lunId int, arrayIdentifier []string) error // For NVME lunID will be namespace ID.
	GetMpathDevice(volumeId string) (string, error)
	FlushMultipathDevice(mpathDevice string) error
	RemovePhysicalDevice(sysDevices []string) error
	ValidateLun(lun int, sysDevices []string) error
}

func NewOsDeviceConnectivityFc added in v0.9.0

func NewOsDeviceConnectivityFc(executer executer.ExecuterInterface) OsDeviceConnectivityInterface

func NewOsDeviceConnectivityNvmeOFc added in v1.8.0

func NewOsDeviceConnectivityNvmeOFc(executer executer.ExecuterInterface) OsDeviceConnectivityInterface

type OsDeviceConnectivityIscsi

type OsDeviceConnectivityIscsi struct {
	Executer          executer.ExecuterInterface
	HelperScsiGeneric OsDeviceConnectivityHelperScsiGenericInterface
}

func (OsDeviceConnectivityIscsi) EnsureLogin added in v1.1.0

func (r OsDeviceConnectivityIscsi) EnsureLogin(allPortalsByTarget map[string][]string)

func (OsDeviceConnectivityIscsi) FlushMultipathDevice

func (r OsDeviceConnectivityIscsi) FlushMultipathDevice(mpathDevice string) error

func (OsDeviceConnectivityIscsi) GetMpathDevice

func (r OsDeviceConnectivityIscsi) GetMpathDevice(volumeId string) (string, error)

func (OsDeviceConnectivityIscsi) RemovePhysicalDevice

func (r OsDeviceConnectivityIscsi) RemovePhysicalDevice(sysDevices []string) error

func (OsDeviceConnectivityIscsi) RescanDevices

func (r OsDeviceConnectivityIscsi) RescanDevices(lunId int, arrayIdentifiers []string) error

func (OsDeviceConnectivityIscsi) ValidateLun added in v1.9.0

func (r OsDeviceConnectivityIscsi) ValidateLun(lun int, sysDevices []string) error

type OsDeviceConnectivityNvmeOFc added in v1.8.0

type OsDeviceConnectivityNvmeOFc struct {
	Executer          executer.ExecuterInterface
	HelperScsiGeneric OsDeviceConnectivityHelperScsiGenericInterface
}

func (OsDeviceConnectivityNvmeOFc) EnsureLogin added in v1.8.0

func (r OsDeviceConnectivityNvmeOFc) EnsureLogin(_ map[string][]string)

func (OsDeviceConnectivityNvmeOFc) FlushMultipathDevice added in v1.8.0

func (r OsDeviceConnectivityNvmeOFc) FlushMultipathDevice(mpathDevice string) error

func (OsDeviceConnectivityNvmeOFc) GetMpathDevice added in v1.8.0

func (r OsDeviceConnectivityNvmeOFc) GetMpathDevice(volumeId string) (string, error)

func (OsDeviceConnectivityNvmeOFc) RemovePhysicalDevice added in v1.8.0

func (r OsDeviceConnectivityNvmeOFc) RemovePhysicalDevice(sysDevices []string) error

func (OsDeviceConnectivityNvmeOFc) RescanDevices added in v1.8.0

func (r OsDeviceConnectivityNvmeOFc) RescanDevices(_ int, _ []string) error

func (OsDeviceConnectivityNvmeOFc) ValidateLun added in v1.9.0

func (r OsDeviceConnectivityNvmeOFc) ValidateLun(_ int, _ []string) error

type VolumeIdNotFoundForMultipathDeviceNameError added in v1.10.0

type VolumeIdNotFoundForMultipathDeviceNameError struct {
	// contains filtered or unexported fields
}

func (*VolumeIdNotFoundForMultipathDeviceNameError) Error added in v1.10.0

type WaitForMpathResult added in v1.2.0

type WaitForMpathResult struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL