Documentation ¶
Overview ¶
Package connector provide methods of interacting with the host
Package connector provide methods of interacting with the host ¶
Package connector provide methods of interacting with the host ¶
Package connector provide methods of interacting with the host ¶
Package connector provide methods of interacting with the host ¶
Package connector is a package that used to operate host devices
Index ¶
- Constants
- Variables
- func CheckConnectSuccess(ctx context.Context, device, tgtLunWWN string) bool
- func CheckHostConnectivity(ctx context.Context, portal string) bool
- func CleanDeviceByLunId(ctx context.Context, lunId string, targets []string) error
- func ClearResidualPath(ctx context.Context, lunWWN string, volumeMode interface{}) error
- func ClearUnavailableDevice(ctx context.Context, device, lunWWN string) string
- func ConnectVolumeCommon(ctx context.Context, conn map[string]interface{}, tgtLunWWN, protocol string, ...) (string, error)
- func ConsistentRead(filename string, attempts int) ([]byte, error)
- func DeleteSDDev(ctx context.Context, sd string) error
- func DisConnectVolume(ctx context.Context, tgtLunWWN string, f func(context.Context, string) error) error
- func DisConnectVolumeCommon(ctx context.Context, tgtLunWWN, protocol string, ...) error
- func FindAllArrays(ctx context.Context) ([]string, error)
- func FindArrayByTarget(ctx context.Context, targets, arrayIds []string) (string, error)
- func FindAvailableMultiPath(ctx context.Context, foundDevices []string) (string, bool)
- func GetDeviceFromMountFile(ctx context.Context, targetPath string, checkDevRef bool) (string, error)
- func GetDeviceFromSymLink(targetPath string) (string, error)
- func GetDeviceFromUltraPath(ctx context.Context, upDevice string) ([]string, error)
- func GetDeviceFromUltraPathNVMe(ctx context.Context, upDevice string) ([]string, error)
- func GetDiskNameByWWN(ctx context.Context, upType, lunWWN string) (string, error)
- func GetDiskPathAndCheckStatus(ctx context.Context, upType, lunWWN string) (string, error)
- func GetFsTypeByDevPath(ctx context.Context, devicePath string) (string, error)
- func GetLunWWNByDevName(ctx context.Context, upType, dev string) (string, error)
- func GetNVMeDevice(ctx context.Context, devicePort string, tgtLunGUID string) (string, error)
- func GetNVMeDeviceFromUltraPathNVMe(ctx context.Context, upDevice string) ([]string, error)
- func GetPhyDev(ctx context.Context, upType, vLunID, deviceType string) ([]string, error)
- func GetPhyDevicesFromDM(dm string) ([]string, error)
- func GetUltraPathDetailsByPath(ctx context.Context, upType, device string) (string, error)
- func GetUltraPathDetailsByvLunID(ctx context.Context, upType, vLunID string) (string, error)
- func GetUltraPathIOSuspensionTime(ctx context.Context, upType, vlunID string) (string, error)
- func GetUltraPathInfoByDevName(ctx context.Context, upType, devName string) (string, error)
- func GetUltraPathInfoByLunWWN(ctx context.Context, upType, targetLunWWN string) (string, error)
- func GetVLunIDByDevName(ctx context.Context, upType, devName string) (string, error)
- func GetWwnByDevice(ctx context.Context, devicePath string) (string, error)
- func GetWwnFromTargetPath(ctx context.Context, volumeId, targetPath string, checkDevRef bool) (string, error)
- func IsDeviceFormatted(ctx context.Context, dev string) (bool, error)
- func IsMultiPathAvailable(ctx context.Context, mPath, lunWWN string, devices []string) (bool, error)
- func MountPathIsExist(ctx context.Context, mountPoint string) (bool, error)
- func ReadMountPoints(ctx context.Context) (map[string]string, error)
- func ReadNxupFile(ctx context.Context) (string, error)
- func ReadNxupMap(ctx context.Context, lunId string) ([]ultrapathDeviceInfo, error)
- func RegisterConnector(cType string, cnt Connector) error
- func RemoveDevice(ctx context.Context, device string) (string, error)
- func RemoveDevices(ctx context.Context, devices []string) error
- func RemoveUltraPathDevice(ctx context.Context, virtualDevice string, phyDevices []string) error
- func RemoveUltraPathNVMeDevice(ctx context.Context, virtualDevice string, phyDevices []string) error
- func ResizeBlock(ctx context.Context, tgtLunWWN string, requiredBytes int64) error
- func SetUltraPathIOSuspensionTime(ctx context.Context, upType, vlunID, time string) error
- func VerifyDeviceAvailableOfDM(ctx context.Context, tgtLunWWN string, expectPathNumber int, ...) (string, error)
- func VerifyDeviceAvailableOfUltraPath(ctx context.Context, upType, diskName string) (string, error)
- func VerifyMultiPathDevice(ctx context.Context, mPath, lunWWN, errCode string, ...) (string, error)
- type ConnectInfo
- type Connector
- type DMDeviceInfo
- type DisConnectInfo
Constants ¶
const ( // FCDriver name string FCDriver = "fibreChannel" // FCNVMeDriver name string FCNVMeDriver = "FC-NVMe" // ISCSIDriver name string ISCSIDriver = "iSCSI" // RoCEDriver name string RoCEDriver = "RoCE" // LocalDriver name string LocalDriver = "Local" // NFSDriver name string NFSDriver = "NFS" // NFSPlusDriver name string NFSPlusDriver = "NFS+" // MountFSType file system type MountFSType = "fs" // MountBlockType block type MountBlockType = "block" // HCTLLength length of HCTL HCTLLength = 4 // UltraPathCommand ultra-path name string UltraPathCommand = "ultraPath" // UltraPathNVMeCommand ultra-path-NVMe name string UltraPathNVMeCommand = "ultraPath-NVMe" // DMMultiPath DM-multipath name string DMMultiPath = "DM-multipath" // HWUltraPath HW-UltraPath name string HWUltraPath = "HW-UltraPath" // HWUltraPathNVMe HW-UltraPath-NVMe name string HWUltraPathNVMe = "HW-UltraPath-NVMe" // UnsupportedMultiPathType multi-path type not supported UnsupportedMultiPathType = "UnsupportedMultiPathType" // VolumeNotFound the message of volume not found error VolumeNotFound = "VolumeDeviceNotFound" // VolumePathIncomplete the message of volume path incomplete VolumePathIncomplete = "VolumePathIncomplete" // PingCommand "ping" command format string PingCommand = "ping -c 3 -i 0.001 -w 1 %s" )
const ( // Connect field is used for lock Connect = "connect" // DisConnect field is used for lock DisConnect = "disConnect" // Extend field is used for lock Extend = "extend" // VolumeDeviceNotFound field is used for find no volume device VolumeDeviceNotFound = "volume device not found" )
const ( // NotUseMultipath means the device does not use multipath service NotUseMultipath = iota // UseDMMultipath means the device use DM-Multipath service UseDMMultipath // UseUltraPath means the device use huawei-UltraPath service UseUltraPath // UseUltraPathNVMe means the device use huawei-UltraPath-NVMe service UseUltraPathNVMe )
Variables ¶
var ( // DisconnectVolumeTimeOut defines the timeout period for disconnecting volume DisconnectVolumeTimeOut = time.Minute // DisconnectVolumeTimeInterval defines the time interval for checking if connected volume DisconnectVolumeTimeInterval = time.Second )
var DoScanNVMeDevice = func(ctx context.Context, devicePort string) error { output, err := utils.ExecShellCmd(ctx, "nvme ns-rescan /dev/%s", devicePort) if err != nil { log.AddContext(ctx).Errorf("Scan nvme port failed. output:%s, error:%v", output, err) return err } return nil }
DoScanNVMeDevice used to scan device by command nvme ns-rescan
var FlushDMDevice = func(ctx context.Context, dm string) error { mPath, _ := utils.ExecShellCmd(ctx, "ls -l /dev/mapper/ | grep -w %s | awk '{print $9}'", dm) if mPath == "" { return fmt.Errorf("get DM device %s", dm) } var err error for i := 0; i < 3; i++ { _, err = utils.ExecShellCmd(ctx, "multipath -f %s", mPath) if err == nil { log.AddContext(ctx).Infof("Flush multipath device %s successful", mPath) break } log.AddContext(ctx).Warningf("Flush multipath device %s error: %v", mPath, err) time.Sleep(time.Second * flushMultiPathInternal) } return err }
FlushDMDevice is the device of flush DM
var GetDevNameByLunWWN = func(ctx context.Context, upType, lunWWN string) (string, error) { output, err := runUpCommand(ctx, upType, "show vlun | grep -w %s", lunWWN) if err != nil { return "", err } ret := utils.GetValueByRegexp(output, `^[\s]*[\d]+[\s]*([\S]+)[\s]+`, 1) if ret == "" { log.AddContext(ctx).Warningf("Get device by lunWWN:%s failed, output:%s", lunWWN, output) return "", nil } return ret, nil }
GetDevNameByLunWWN used to get device name by lun wwn
var GetDeviceSize = func(ctx context.Context, hostDevice string) (int64, error) { output, err := utils.ExecShellCmd(ctx, "blockdev --getsize64 %s", hostDevice) if err != nil { log.AddContext(ctx).Errorf("Failed to get device %s, err is %v", hostDevice, err) return 0, err } outputLines := strings.Split(output, "\n") for _, line := range outputLines { if line == "" { continue } size, err := strconv.ParseInt(line, 10, 64) if err != nil { log.AddContext(ctx).Errorf("Failed to get device size %s, err is %v", line, err) return 0, err } return size, nil } return 0, errors.New("failed to get device size") }
GetDeviceSize to get the device size in bytes
var GetDevicesByGUID = func(ctx context.Context, tgtLunGUID string) ([]string, error) { var devices []string deviceLink, err := getDeviceLink(ctx, tgtLunGUID) if err != nil { return devices, err } devices = getDevices(deviceLink) return devices, nil }
GetDevicesByGUID query device from host. If revert connect volume, no need to check device available
var GetNVMePhysicalDevices = func(ctx context.Context, device string, deviceType int) ([]string, error) { switch deviceType { case NotUseMultipath: return []string{device}, nil case UseUltraPathNVMe: return GetNVMeDeviceFromUltraPathNVMe(ctx, device) default: return nil, utils.Errorf(ctx, "Invalid device type %d.", deviceType) } }
GetNVMePhysicalDevices to get NVMe physical devices
var GetNVMeWwn = func(ctx context.Context, device string) (string, error) { cmd := fmt.Sprintf("nvme id-ns %s -o json", device) output, err := utils.ExecShellCmdFilterLog(ctx, cmd) if err != nil { log.AddContext(ctx).Errorf("Failed to get nvme id of device %s, err is %v", device, err) return "", err } var deviceInfo map[string]interface{} if err = json.Unmarshal([]byte(output), &deviceInfo); err != nil { log.AddContext(ctx).Errorf("Failed to unmarshal input %s", output) return "", errors.New("failed to unmarshal device info") } if uuid, exist := deviceInfo["nguid"]; exist { return uuid.(string), nil } return "", errors.New("there is no nguid in device info") }
GetNVMeWwn get the unique id of the device
var GetPhysicalDevices = func(ctx context.Context, device string, deviceType int) ([]string, error) { switch deviceType { case NotUseMultipath: return []string{device}, nil case UseDMMultipath: return GetPhyDevicesFromDM(device) case UseUltraPath: return GetDeviceFromUltraPath(ctx, device) case UseUltraPathNVMe: return GetDeviceFromUltraPathNVMe(ctx, device) default: return nil, utils.Errorf(ctx, "Invalid device type %d.", deviceType) } }
GetPhysicalDevices to get physical devices
var GetSCSIWwn = func(ctx context.Context, hostDevice string) (string, error) { var wwn string var err error readable, err := IsDeviceReadable(ctx, hostDevice) if readable && err == nil { wwn, err = getSCSIWwnByScsiID(ctx, hostDevice) if err != nil { log.AddContext(ctx).Warningf("get device %s wwn by scsi_id error: %v", hostDevice, err) } } else { if strings.HasPrefix(hostDevice, "/dev/sd") { wwn, err = getSCSIWwnByWWid(ctx, hostDevice) } } return wwn, err }
GetSCSIWwn to get the device wwn
var GetSubSysInfo = func(ctx context.Context) (map[string]interface{}, error) { err := checkNVMeVersion(ctx) if err != nil { return nil, utils.Errorf(ctx, "Failed to check the NVMe version. err:%v", err) } output, err := utils.ExecShellCmdFilterLog(ctx, "nvme list-subsys -o json") if err != nil { log.AddContext(ctx).Errorf("Get exist nvme connect info failed, output:%s, error:%v", output, err) return nil, errors.New("get nvme connect port failed") } var nvmeConnectInfo map[string]interface{} if err = json.Unmarshal([]byte(output), &nvmeConnectInfo); err != nil { return nil, errors.New("unmarshal nvme connect info failed") } return nvmeConnectInfo, nil }
GetSubSysInfo used to get subsys info by command nvme list-subsys
var GetVirtualDevice = func(ctx context.Context, tgtLunGUID string) (string, int, error) { var virtualDevice string var deviceType int devices, err := GetDevicesByGUID(ctx, tgtLunGUID) if err != nil { return virtualDevice, 0, err } var virtualDevices []string var phyDevices []string for _, device := range devices { device = strings.TrimSpace(device) partitionDev, err := isPartitionDevice(ctx, device) if err != nil { return "", 0, utils.Errorf(ctx, "check device: %s is a partition device failed. error: %v", device, err) } else if partitionDev { log.AddContext(ctx).Infof("Device: %s is a partition device,skip", device) continue } if strings.HasPrefix(device, "ultrapath") { deviceType = UseUltraPathNVMe virtualDevices = append(virtualDevices, device) } else if strings.HasPrefix(device, "dm") { deviceType = UseDMMultipath virtualDevices = append(virtualDevices, device) } else if strings.HasPrefix(device, "sd") && isUltraPathDevice(ctx, device) { deviceType = UseUltraPath virtualDevices = append(virtualDevices, device) } else if strings.HasPrefix(device, "sd") || strings.HasPrefix(device, "nvme") { phyDevices = append(phyDevices, device) } else { log.AddContext(ctx).Warningf("Unknown device link: %s", device) } } log.AddContext(ctx).Infof("Find virtual devices: %v, physical devices: %v", virtualDevices, phyDevices) return getVirtualDevice(ctx, virtualDevices, phyDevices, tgtLunGUID, deviceType) }
GetVirtualDevice used to get virtual device by WWN/GUID
var IsDeviceAvailable = func(ctx context.Context, device, lunWWN string) (bool, error) { var devWWN string var err error if strings.Contains(device, "sd") { devWWN, err = GetSCSIWwn(ctx, device) } else if strings.Contains(device, "nvme") { devWWN, err = GetNVMeWwn(ctx, device) } else { devWWN, err = GetSCSIWwn(ctx, device) } if err != nil { return false, err } if devWWN == "" { return false, nil } if !strings.Contains(devWWN, lunWWN) { return false, errors.New("the device WWN is not equal to lun WWN") } return true, nil }
IsDeviceAvailable compares the sd device WWN with the lun WWN
var IsDeviceReadable = func(ctx context.Context, devicePath string) (bool, error) { _, err := ReadDevice(ctx, devicePath) if err != nil { log.AddContext(ctx).Warningf("Device:%s is unreadable.", devicePath) return false, err } return true, nil }
IsDeviceReadable to check the device is readable or not
var IsInFormatting = func(ctx context.Context, sourcePath, fsType string) (bool, error) { var cmd string if fsType != "ext2" && fsType != "ext3" && fsType != "ext4" && fsType != "xfs" { return false, utils.Errorf(ctx, "Do not support the type %s.", fsType) } cmd = fmt.Sprintf("ps -aux | grep mkfs | grep -w %s | wc -l |awk '{if($1>1) print 1; else print 0}'", sourcePath) output, err := utils.ExecShellCmd(ctx, cmd) if err != nil { return false, err } outputSplit := strings.Split(output, "\n") return len(outputSplit) != 0 && outputSplit[0] == "1", nil }
IsInFormatting is to check the device whether in formatting
var IsUpNVMeResidualPath = func(ctx context.Context, devName, lunWWN string) (bool, error) { return isUpNVMeResidualPath(ctx, &deviceInfo{deviceName: devName, lunWWN: lunWWN, multipathType: UseUltraPathNVMe, deviceFullName: "/dev/" + devName}) }
IsUpNVMeResidualPath used to determine whether the device is residual
var ReadDevice = func(ctx context.Context, dev string) ([]byte, error) { log.AddContext(ctx).Infof("Checking to see if %s is readable.", dev) out, err := utils.ExecShellCmdFilterLog(ctx, "dd if=%s bs=1024 count=512 status=none", dev) if err != nil { return nil, err } output := []byte(out) if len(output) != halfMiDataLength { return nil, utils.Errorf(ctx, "can not read 512KiB bytes from the device %s, instead read %d bytes", dev, len(output)) } if strings.Contains(out, "0+0 records in") { return nil, utils.Errorf(ctx, "the size of %s may be zero, it is abnormal device", dev) } return output, nil }
ReadDevice is to check whether the device is readable
var RemoveAllDevice = func(ctx context.Context, virtualDevice string, phyDevices []string, deviceType int) (string, error) { switch deviceType { case NotUseMultipath, UseDMMultipath: return RemoveDevice(ctx, virtualDevice) case UseUltraPath: return "", RemoveUltraPathDevice(ctx, virtualDevice, phyDevices) case UseUltraPathNVMe: return "", RemoveUltraPathNVMeDevice(ctx, virtualDevice, phyDevices) default: return "", utils.Errorln(ctx, "invalid device type") } }
RemoveAllDevice to remove the device through virtual device and physical device
var ResizeMountPath = func(ctx context.Context, volumePath string) error { output, err := utils.ExecShellCmd(ctx, "findmnt -o source --noheadings --target %s", volumePath) if err != nil { return fmt.Errorf("findmnt volumePath: %s error: %v", volumePath, err) } devicePath := strings.TrimSpace(output) if len(devicePath) == 0 { return fmt.Errorf("could not get valid device for mount path: %s", volumePath) } fsType, err := GetFsTypeByDevPath(ctx, devicePath) if err != nil { return err } if fsType == "" { return nil } switch fsType { case "ext2", "ext3", "ext4": return extResize(ctx, devicePath) case "xfs": return xfsResize(ctx, volumePath) default: return fmt.Errorf("resize of format %s is not supported for device %s", fsType, devicePath) } }
ResizeMountPath Resize the mount point by using the volume path
var VerifySingleDevice = func(ctx context.Context, device, lunWWN, errCode string, f func(context.Context, string) error) error { log.AddContext(ctx).Infof("Found the dev %s", device) _, err := ReadDevice(ctx, device) if err != nil { return err } available, err := IsDeviceAvailable(ctx, device, lunWWN) if err != nil && err.Error() != "the device WWN is not equal to lun WWN" { return err } if !available { err = f(ctx, lunWWN) if err != nil { log.AddContext(ctx).Errorf("delete device err while revert connect volume. Err is: %v", err) } return errors.New(errCode) } return nil }
VerifySingleDevice check the sd device whether available
Functions ¶
func CheckConnectSuccess ¶
CheckConnectSuccess is to check the sd device available
func CheckHostConnectivity ¶
CheckHostConnectivity used to check host connectivity
func CleanDeviceByLunId ¶
CleanDeviceByLunId clean device by Lun id
func ClearResidualPath ¶
ClearResidualPath used to clear residual path
func ClearUnavailableDevice ¶
ClearUnavailableDevice is to check the sd device connect success, otherwise delete the device
func ConnectVolumeCommon ¶
func ConnectVolumeCommon(ctx context.Context, conn map[string]interface{}, tgtLunWWN, protocol string, f func(context.Context, map[string]interface{}) (string, error)) (string, error)
ConnectVolumeCommon used for connect volume for all protocol
func ConsistentRead ¶
ConsistentRead repeatedly reads a file until it gets the same content twice. This is useful when reading files in /proc/mount that are larger than page size and kernel may modify them between individual read() syscalls
func DeleteSDDev ¶
DeleteSDDev is used to delete the sd device
func DisConnectVolume ¶
func DisConnectVolume(ctx context.Context, tgtLunWWN string, f func(context.Context, string) error) error
DisConnectVolume delete all devices which match to lunWWN
func DisConnectVolumeCommon ¶
func DisConnectVolumeCommon(ctx context.Context, tgtLunWWN, protocol string, f func(context.Context, string) error) error
DisConnectVolumeCommon used for disconnect volume for all protocol
func FindAllArrays ¶
FindAllArrays find all arrays
func FindArrayByTarget ¶
FindArrayByTarget find array by iqn
func FindAvailableMultiPath ¶
FindAvailableMultiPath is to get dm-multipath through sd devices
func GetDeviceFromMountFile ¶
func GetDeviceFromMountFile(ctx context.Context, targetPath string, checkDevRef bool) (string, error)
GetDeviceFromMountFile parse the mount file and get devicePath from targetPath. If a device is associated with multiple paths, an error will be returned
func GetDeviceFromSymLink ¶
GetDeviceFromSymLink returns link path if specified file exists and the type is symbolik link. If file doesn't exist, or file exists but not symbolic link, returns an empty string with error from Lstat().
func GetDeviceFromUltraPath ¶
GetDeviceFromUltraPath used to get physical device from ultrapath
func GetDeviceFromUltraPathNVMe ¶
GetDeviceFromUltraPathNVMe used to get physical device from ultrapath-nvme
func GetDiskNameByWWN ¶
GetDiskNameByWWN to get the device name based on the LUN WWN
func GetDiskPathAndCheckStatus ¶
GetDiskPathAndCheckStatus to get the device path and status based on the LUN WWN.
func GetFsTypeByDevPath ¶
GetFsTypeByDevPath use blkid to get fsType
func GetLunWWNByDevName ¶
GetLunWWNByDevName used to get device lun wwn by device name
func GetNVMeDevice ¶
GetNVMeDevice used to get device name by channel
func GetNVMeDeviceFromUltraPathNVMe ¶
GetNVMeDeviceFromUltraPathNVMe used to get physical nvme device from ultrapath-nvme
func GetPhyDevicesFromDM ¶
GetPhyDevicesFromDM used to get physical device from dm-multipath
func GetUltraPathDetailsByPath ¶
GetUltraPathDetailsByPath to get the ultraPath detail info by using device path
func GetUltraPathDetailsByvLunID ¶
GetUltraPathDetailsByvLunID to get the ultraPath detail info by using vLun Id
func GetUltraPathIOSuspensionTime ¶
GetUltraPathIOSuspensionTime used to get IO suspension time
func GetUltraPathInfoByDevName ¶
GetUltraPathInfoByDevName to get the ultraPath info by using the device Name
func GetUltraPathInfoByLunWWN ¶
GetUltraPathInfoByLunWWN to get the ultraPath info by using the lun wwn
func GetVLunIDByDevName ¶
GetVLunIDByDevName to get the vLun Id by using device Name
func GetWwnByDevice ¶
GetWwnByDevice get wwn according to multipath and protocol type
func GetWwnFromTargetPath ¶
func GetWwnFromTargetPath(ctx context.Context, volumeId, targetPath string, checkDevRef bool) (string, error)
GetWwnFromTargetPath get wwn form targetPath
func IsDeviceFormatted ¶
IsDeviceFormatted reads 2MiBs of the device to check the device formatted or not
func IsMultiPathAvailable ¶
func IsMultiPathAvailable(ctx context.Context, mPath, lunWWN string, devices []string) (bool, error)
IsMultiPathAvailable compares the dm device WWN with the lun WWN
func MountPathIsExist ¶
MountPathIsExist if mount point exist in /proc/mounts file, this function will return true
func ReadMountPoints ¶
ReadMountPoints read mount file mountMap: key means mountPath; value means devicePath.
func ReadNxupFile ¶
ReadNxupFile read nxup file
func ReadNxupMap ¶
ReadNxupMap read nxup map
func RegisterConnector ¶
RegisterConnector is used to register the specific Connector to the global connector map
func RemoveDevice ¶
RemoveDevice is used to remove specified device
func RemoveDevices ¶
RemoveDevices is used to remove devices
func RemoveUltraPathDevice ¶
RemoveUltraPathDevice to remove the ultrapath device through virtual device and physical device
func RemoveUltraPathNVMeDevice ¶
func RemoveUltraPathNVMeDevice(ctx context.Context, virtualDevice string, phyDevices []string) error
RemoveUltraPathNVMeDevice to remove the ultrapath device through virtual device and physical device
func ResizeBlock ¶
ResizeBlock Resize a block device by using the LUN WWN
func SetUltraPathIOSuspensionTime ¶
SetUltraPathIOSuspensionTime used to set IO suspension time
func VerifyDeviceAvailableOfDM ¶
func VerifyDeviceAvailableOfDM(ctx context.Context, tgtLunWWN string, expectPathNumber int, foundDevices []string, f func(context.Context, string) error) (string, error)
VerifyDeviceAvailableOfDM used to check whether the DM device is available
func VerifyDeviceAvailableOfUltraPath ¶
VerifyDeviceAvailableOfUltraPath used to check whether the UltraPath device is available
Types ¶
type ConnectInfo ¶
ConnectInfo defines the fields of connect volume
type Connector ¶
type Connector interface { // ConnectVolume to mount the source to target path, the source path can be block or nfs // Example: // mount /dev/sdb /<target-path> // mount <source-path> /<target-path> ConnectVolume(context.Context, map[string]interface{}) (string, error) // DisConnectVolume to unmount the target path DisConnectVolume(context.Context, string) error }
Connector defines the behavior that the connector should have
type DMDeviceInfo ¶
type DMDeviceInfo struct { // Name device name Name string // Name device file system Sysfs string // Devices device list Devices []string }
DMDeviceInfo is the information of DM device
func WatchDMDevice ¶
WatchDMDevice is an aggregate drive letter monitor.
type DisConnectInfo ¶
DisConnectInfo defines the fields of disconnect volume
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package fibrechannel provide the way to connect/disconnect volume within FC protocol
|
Package fibrechannel provide the way to connect/disconnect volume within FC protocol |
Package host defines a set of useful methods, which can help Connector to operate host information
|
Package host defines a set of useful methods, which can help Connector to operate host information |
Package iscsi provide the way to connect/disconnect volume within iSCSI protocol
|
Package iscsi provide the way to connect/disconnect volume within iSCSI protocol |
Package local to connect and disconnect local lun
|
Package local to connect and disconnect local lun |
Package nfs to mount or unmount filesystem
|
Package nfs to mount or unmount filesystem |
Package nfs_plus to mount or unmount filesystem
|
Package nfs_plus to mount or unmount filesystem |
Package nvme provide the way to connect/disconnect volume within FC NVMe protocol
|
Package nvme provide the way to connect/disconnect volume within FC NVMe protocol |
Package roce provide the way to connect/disconnect volume within NVMe over RoCE protocol
|
Package roce provide the way to connect/disconnect volume within NVMe over RoCE protocol |
Package utils provides common utils for connector
|
Package utils provides common utils for connector |
lock
Package lock provide Lock and Unlock when manage the disk
|
Package lock provide Lock and Unlock when manage the disk |
models
Package models provides common models for connector
|
Package models provides common models for connector |