scsi

package
v1.99.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

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

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

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

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

DeleteSCSIDeviceByHCTL deletes scsi device specified by HCTL

func (*Scsi) DeleteSCSIDeviceByName

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

DeleteSCSIDeviceByName deletes scsi device specified by name

func (*Scsi) DeleteSCSIDeviceByPath

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

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

GetDMChildren fetches multipath block devices

func (*Scsi) GetDMDeviceByChildren

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

GetDMDeviceByChildren fetches multipath device name

func (*Scsi) GetDeviceNameByHCTL

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

GetDeviceNameByHCTL finds scsi device name by HCTL

func (*Scsi) GetDeviceWWN

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

GetDeviceWWN fetches device WWN

func (*Scsi) GetDevicesByWWN

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

GetDevicesByWWN fetches devices by wwn

func (*Scsi) GetNVMEDMDeviceByChildren

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

GetNVMEDMDeviceByChildren fetches multipath device name

func (*Scsi) GetNVMEDeviceWWN

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

GetNVMEDeviceWWN gets wwn of nvme device

func (*Scsi) GetNVMEMultipathDMName

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

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

IsDeviceExist checks if scsi device exists

func (*Scsi) RescanSCSIDeviceByHCTL

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

RescanSCSIDeviceByHCTL performs scsi device rescan

func (*Scsi) RescanSCSIHostByHCTL

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

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