iscsi

package
v0.0.0-...-7e19304 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2025 License: Apache-2.0 Imports: 14 Imported by: 2

Documentation

Index

Constants

View Source
const (
	ScanTimeout = 10 * time.Second
)

Variables

View Source
var (
	DeviceWaitRetryCounts   = 10
	DeviceWaitRetryInterval = 1 * time.Second

	ScsiNodesDirs = []string{
		"/etc/iscsi/nodes/",
		"/var/lib/iscsi/nodes/",
	}
)
View Source
var (
	TgtdRetryCounts   = 5
	TgtdRetryInterval = 1 * time.Second
)

Functions

func AddLun

func AddLun(tid int, lun int, backingFile string, bstype string, bsopts string) error

AddLun will add a LUN in an existing target, which backing by specified file, using AIO backing-store

func AddLunBackedByFile

func AddLunBackedByFile(tid int, lun int, backingFile string) error

AddLunBackedByFile will add a LUN in an existing target, which backing by specified file.

func BindInitiator

func BindInitiator(tid int, initiator string) error

BindInitiator will add permission to allow certain initiator(s) to connect to certain target. "ALL" is a special initiator which is the wildcard

func CheckForInitiatorExistence

func CheckForInitiatorExistence(nsexec *lhns.Executor) error

func CheckTargetForBackingStore

func CheckTargetForBackingStore(name string) bool

func CleanupScsiNodes

func CleanupScsiNodes(target string) error

func CloseConnection

func CloseConnection(tid int, sid, cid string) error

func CreateTarget

func CreateTarget(tid int, name string) error

CreateTarget will create a iSCSI target using the name specified. If name is unspecified, a name will be generated. Notice the name must comply with iSCSI name format.

func DeleteDiscoveredTarget

func DeleteDiscoveredTarget(ip, target string, nsexec *lhns.Executor) error

func DeleteLun

func DeleteLun(tid int, lun int) error

DeleteLun will remove a LUN from an target

func DeleteTarget

func DeleteTarget(tid int) error

DeleteTarget will remove a iSCSI target specified by tid

func DisableWriteCache

func DisableWriteCache(tid int, lun int) error

DisableWriteCache will set param write-cache to false for the LUN

func DiscoverTarget

func DiscoverTarget(ip, target string, nsexec *lhns.Executor) error

func ExpandLun

func ExpandLun(tid, lun int, size int64) error

ExpandLun will update the size for the LUN. This is valid only for the customized tgt https://github.com/rancher/tgt/

func FindNextAvailableTargetID

func FindNextAvailableTargetID() (int, error)

func GetDevice

func GetDevice(ip, target string, lun int, nsexec *lhns.Executor) (*lhtypes.BlockDeviceInfo, error)

func GetTargetConnections

func GetTargetConnections(tid int) (map[string][]string, error)

func GetTargetTid

func GetTargetTid(name string) (int, error)

GetTargetTid If returned TID is -1, then target doesn't exist, but we won't return error

func IsTargetDiscovered

func IsTargetDiscovered(ip, target string, nsexec *lhns.Executor) bool

func IsTargetLoggedIn

func IsTargetLoggedIn(ip, target string, nsexec *lhns.Executor) bool

IsTargetLoggedIn check all portals if ip == ""

func LoginTarget

func LoginTarget(ip, target string, nsexec *lhns.Executor) error

func LogoutTarget

func LogoutTarget(ip, target string, nsexec *lhns.Executor) error

LogoutTarget will logout all sessions if ip == ""

func RescanTarget

func RescanTarget(ip, target string, nsexec *lhns.Executor) error

func SetLunThinProvisioning

func SetLunThinProvisioning(tid int, lun int) error

SetLunThinProvisioning will set param thin_provisioning to true for the LUN

func ShutdownTgtd

func ShutdownTgtd() error

func StartDaemon

func StartDaemon(debug bool) error

StartDaemon will start tgtd daemon, prepare for further commands

func UnbindInitiator

func UnbindInitiator(tid int, initiator string) error

UnbindInitiator will remove permission to allow certain initiator(s) to connect to certain target.

func UpdateIscsiDeviceAbortTimeout

func UpdateIscsiDeviceAbortTimeout(target string, timeout int64, nsexec *lhns.Executor) error

func UpdateLun

func UpdateLun(tid int, lun int, params map[string]string) error

UpdateLun will update parameters for the LUN

func UpdateScsiDeviceTimeout

func UpdateScsiDeviceTimeout(devName string, timeout int64, nsexec *lhns.Executor) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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