scsi

package
v1.10.1 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const (
	NVMEMultipathSleepTime = 500
	NVMESymlinkSleepTime   = 200
)

constants

Variables

This section is empty.

Functions

This section is empty.

Types

type DevicesHaveDifferentParentsErr

type DevicesHaveDifferentParentsErr struct{}

DevicesHaveDifferentParentsErr defines a custom error

func (*DevicesHaveDifferentParentsErr) Error

func (dperr *DevicesHaveDifferentParentsErr) Error() string

type HCTL

type HCTL struct {
	Host    string
	Channel string
	Target  string
	Lun     string
}

HCTL defines host, channel, target, lun info

func (*HCTL) IsFullInfo

func (h *HCTL) IsFullInfo() bool

IsFullInfo validates HCTL struct

type Scsi added in v1.3.0

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

Scsi defines scsi info

func NewSCSI

func NewSCSI(chroot string) *Scsi

NewSCSI initializes scsi struct

func (*Scsi) CheckDeviceIsValid added in v1.3.0

func (s *Scsi) CheckDeviceIsValid(ctx context.Context, device string) bool

CheckDeviceIsValid checks if device specified is valid by performing io operation on the device

func (*Scsi) DeleteSCSIDeviceByHCTL added in v1.3.0

func (s *Scsi) DeleteSCSIDeviceByHCTL(ctx context.Context, h HCTL) error

DeleteSCSIDeviceByHCTL deletes scsi device specified by HCTL

func (*Scsi) DeleteSCSIDeviceByName added in v1.3.0

func (s *Scsi) DeleteSCSIDeviceByName(ctx context.Context, name string) error

DeleteSCSIDeviceByName deletes scsi device specified by name

func (*Scsi) DeleteSCSIDeviceByPath added in v1.3.0

func (s *Scsi) DeleteSCSIDeviceByPath(ctx context.Context, devPath string) error

DeleteSCSIDeviceByPath deletes device by specified "device folder" path Examples:

	/sys/block/sde/device/
	/sys/class/scsi_device/37:0:0:1/device/
    /sys/class/iscsi_session/session3/device/target37:0:0/37:0:0:1/

func (*Scsi) GetDMChildren added in v1.3.0

func (s *Scsi) GetDMChildren(ctx context.Context, dm string) ([]string, error)

GetDMChildren fetches multipath block devices

func (*Scsi) GetDMDeviceByChildren added in v1.3.0

func (s *Scsi) GetDMDeviceByChildren(ctx context.Context, devices []string) (string, error)

GetDMDeviceByChildren fetches multipath device name

func (*Scsi) GetDeviceNameByHCTL added in v1.3.0

func (s *Scsi) GetDeviceNameByHCTL(ctx context.Context, h HCTL) (string, error)

GetDeviceNameByHCTL finds scsi device name by HCTL

func (*Scsi) GetDeviceWWN added in v1.3.0

func (s *Scsi) GetDeviceWWN(ctx context.Context, devices []string) (string, error)

GetDeviceWWN fetches device WWN

func (*Scsi) GetDevicesByWWN added in v1.3.0

func (s *Scsi) GetDevicesByWWN(ctx context.Context, wwn string) ([]string, error)

GetDevicesByWWN fetches devices by wwn

func (*Scsi) GetNVMEDMDeviceByChildren added in v1.3.0

func (s *Scsi) GetNVMEDMDeviceByChildren(ctx context.Context, devices []string) (string, error)

GetNVMEDMDeviceByChildren fetches multipath device name

func (*Scsi) GetNVMEDeviceWWN added in v1.3.0

func (s *Scsi) GetNVMEDeviceWWN(ctx context.Context, devices []string) (string, error)

GetNVMEDeviceWWN gets wwn of nvme device

func (*Scsi) GetNVMEMultipathDMName added in v1.3.0

func (s *Scsi) GetNVMEMultipathDMName(device string, pattern string) ([]string, error)

GetNVMEMultipathDMName finds the multipath DM mame for NVMe

func (s *Scsi) GetNVMESymlink(checkPath string) (string, error)

GetNVMESymlink return the NVMe symlink for the given path

func (*Scsi) IsDeviceExist added in v1.3.0

func (s *Scsi) IsDeviceExist(ctx context.Context, device string) bool

IsDeviceExist checks if scsi device exists

func (*Scsi) RescanSCSIDeviceByHCTL added in v1.3.0

func (s *Scsi) RescanSCSIDeviceByHCTL(ctx context.Context, h HCTL) error

RescanSCSIDeviceByHCTL performs scsi device rescan

func (*Scsi) RescanSCSIHostByHCTL added in v1.3.0

func (s *Scsi) RescanSCSIHostByHCTL(ctx context.Context, addr HCTL) error

RescanSCSIHostByHCTL performs scsi host rescan

func (s *Scsi) WaitUdevSymlink(ctx context.Context, deviceName string, wwn string) error

WaitUdevSymlink checks if udev symlink for device specified by device name with WWN is found

func (*Scsi) WaitUdevSymlinkNVMe added in v1.3.0

func (s *Scsi) WaitUdevSymlinkNVMe(ctx context.Context, deviceName string, wwn string) error

WaitUdevSymlinkNVMe checks if udev symlink for device specified by device name with WWN is found for nvme

Jump to

Keyboard shortcuts

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