Documentation
¶
Index ¶
- Constants
- Variables
- func FormatPRKey(s string) string
- func ListHostDirs() ([]string, error)
- func LockedScanAll(timeout time.Duration) error
- func ScanAll() error
- func ScanAllBusTargetLun(b, t, l string) error
- func ScanHostBusTargetLun(h, b, t, l string) error
- func ScanHostDirBusTargetLun(h, b, t, l string) error
- func ScanSCSIHosts(hba, target, lun string) error
- func StripPRKey(s string) string
- type FullStatusEntry
- type FullStatusReader
- type MpathPersistDriver
- func (t MpathPersistDriver) Clear(dev device.T, key string) error
- func (t MpathPersistDriver) Preempt(dev device.T, oldKey, newKey string) error
- func (t MpathPersistDriver) PreemptAbort(dev device.T, oldKey, newKey string) error
- func (t MpathPersistDriver) ReadFullStatus(dev device.T) ([]FullStatusEntry, error)
- func (t MpathPersistDriver) ReadRegistrations(dev device.T) ([]string, error)
- func (t MpathPersistDriver) ReadReservation(dev device.T) (string, error)
- func (t MpathPersistDriver) Register(dev device.T, key string) error
- func (t MpathPersistDriver) Release(dev device.T, key string) error
- func (t MpathPersistDriver) Reserve(dev device.T, key string) error
- func (t MpathPersistDriver) Unregister(dev device.T, key string) error
- type PersistentReservationDriver
- type PersistentReservationHandle
- func (t *PersistentReservationHandle) DeviceExpectedRegistrationCount(dev device.T) (int, error)
- func (t *PersistentReservationHandle) DeviceStatus(dev device.T) status.T
- func (t *PersistentReservationHandle) Start() error
- func (t *PersistentReservationHandle) Status() status.T
- func (t *PersistentReservationHandle) Stop() error
- type PersistentReservationStatus
- type SGPersistDriver
- func (t SGPersistDriver) Clear(dev device.T, key string) error
- func (t SGPersistDriver) Preempt(dev device.T, oldKey, newKey string) error
- func (t SGPersistDriver) PreemptAbort(dev device.T, oldKey, newKey string) error
- func (t SGPersistDriver) ReadFullStatus(dev device.T) ([]FullStatusEntry, error)
- func (t SGPersistDriver) ReadRegistrations(dev device.T) ([]string, error)
- func (t SGPersistDriver) ReadReservation(dev device.T) (string, error)
- func (t SGPersistDriver) Register(dev device.T, key string) error
- func (t SGPersistDriver) Release(dev device.T, key string) error
- func (t SGPersistDriver) Reserve(dev device.T, key string) error
- func (t SGPersistDriver) Unregister(dev device.T, key string) error
Constants ¶
const ( MpathPersistCapability = "node.x.scsi.mpathpersist" SGPersistCapability = "node.x.scsi.sg_persist" )
Variables ¶
var ( DefaultPersistentReservationType = "5" // Write-Exclusive Registrants-Only ErrNotSupported = errors.New("the SCSI PR is not supported on this node: no usable mpathpersist or sg_persist") )
var ( // ErrNoNexus is the error of the paths of a device the transport of // tells no nexus of, as a fibre channel one, whose nexus does not // change across a restart. ErrNoNexus = errors.New("no nexus known for the paths of the device") )
Functions ¶
func FormatPRKey ¶
FormatPRKey formats a string key by stripping a leading "0x", truncating it to 16 characters if necessary, and padding it with leading zeroes. The formatted key is returned with a "0x" prefix. It is used to format the reservation or registration key read from device and the configured node scsi key.
"0xa" -> "0x000000000000000a" "0xab" -> "0x00000000000000ab" "0x1234567890123456789" -> "0x1234567890123456" "0x1234567890123456" -> "0x1234567890123456"
func ListHostDirs ¶
func LockedScanAll ¶
func ScanAllBusTargetLun ¶
func ScanHostBusTargetLun ¶
func ScanHostDirBusTargetLun ¶
func ScanSCSIHosts ¶
ScanSCSIHosts scans SCSI hosts for new devices hba and target are port names in the SCSI transport (e.g., WWN or iSCSI names) If hba and target are empty, all hosts will be scanned If only hba is provided, all targets on that host(s) will be scanned If hba and target are provided, specific target will be scanned on each host lun specifies the logical unit number to scan
func StripPRKey ¶
Types ¶
type FullStatusEntry ¶
FullStatusEntry is a registration as a READ FULL STATUS of the persistent reservation says it: its key, the nexus it belongs to, the transport id of the initiator port and the relative target port, and whether it holds the reservation.
type FullStatusReader ¶
type FullStatusReader interface {
ReadFullStatus(dev device.T) ([]FullStatusEntry, error)
}
FullStatusReader is a driver reading the full status of the persistent reservation of a device. The command is optional to the targets, and a driver may not support it.
type MpathPersistDriver ¶
func (MpathPersistDriver) Preempt ¶
func (t MpathPersistDriver) Preempt(dev device.T, oldKey, newKey string) error
func (MpathPersistDriver) PreemptAbort ¶
func (t MpathPersistDriver) PreemptAbort(dev device.T, oldKey, newKey string) error
func (MpathPersistDriver) ReadFullStatus ¶
func (t MpathPersistDriver) ReadFullStatus(dev device.T) ([]FullStatusEntry, error)
ReadFullStatus reads the full status of the reservation of the device.
func (MpathPersistDriver) ReadRegistrations ¶
func (t MpathPersistDriver) ReadRegistrations(dev device.T) ([]string, error)
func (MpathPersistDriver) ReadReservation ¶
func (t MpathPersistDriver) ReadReservation(dev device.T) (string, error)
func (MpathPersistDriver) Register ¶
func (t MpathPersistDriver) Register(dev device.T, key string) error
func (MpathPersistDriver) Release ¶
func (t MpathPersistDriver) Release(dev device.T, key string) error
func (MpathPersistDriver) Reserve ¶
func (t MpathPersistDriver) Reserve(dev device.T, key string) error
func (MpathPersistDriver) Unregister ¶
func (t MpathPersistDriver) Unregister(dev device.T, key string) error
type PersistentReservationDriver ¶
type PersistentReservationDriver interface {
ReadRegistrations(dev device.T) ([]string, error)
Register(dev device.T, key string) error
Unregister(dev device.T, key string) error
ReadReservation(dev device.T) (string, error)
Reserve(dev device.T, key string) error
Release(dev device.T, key string) error
Clear(dev device.T, key string) error
Preempt(dev device.T, oldKey, newKey string) error
PreemptAbort(dev device.T, oldKey, newKey string) error
}
type PersistentReservationHandle ¶
type PersistentReservationHandle struct {
Key string
Devices device.L
NoPreemptAbort bool
Force bool
Log *plog.Logger
StatusLogger statusLogger
CurrentStatus PersistentReservationStatus
CoresourceDisabled bool
CoresourceStatus status.T
// ForeignReserved are the devices another key holds the
// reservation of, as the last Status found them.
ForeignReserved []string
// contains filtered or unexported fields
}
func (*PersistentReservationHandle) DeviceExpectedRegistrationCount ¶
func (t *PersistentReservationHandle) DeviceExpectedRegistrationCount(dev device.T) (int, error)
func (*PersistentReservationHandle) DeviceStatus ¶
func (t *PersistentReservationHandle) DeviceStatus(dev device.T) status.T
func (*PersistentReservationHandle) Start ¶
func (t *PersistentReservationHandle) Start() error
func (*PersistentReservationHandle) Status ¶
func (t *PersistentReservationHandle) Status() status.T
func (*PersistentReservationHandle) Stop ¶
func (t *PersistentReservationHandle) Stop() error
Stop releases the reservation the node holds on the devices, and unregisters the paths of the node.
A registration, and a reservation, belong to a path, an I_T nexus, and the nexus of an iscsi path changes when the node restarts, its initiator session ids given in login order: after a restart, the paths of the node are not the ones registered, and a release from them was refused, failing the stop and the unprovision of every instance not started since. The paths are registered before the release, and a reservation of our key still held after it, by a path of before, is preempted from a current path, which takes it and drops the registrations of our key the other paths hold, so the release works.
A reservation another key holds is left alone, and no path is registered then: a registration would give the node the write access to a device another node holds. The registrations of our key left there are the ones of paths of before, or the holder took them away.
type PersistentReservationStatus ¶
type PersistentReservationStatus struct {
ReservedBy *string
}
type SGPersistDriver ¶
func (SGPersistDriver) Preempt ¶
func (t SGPersistDriver) Preempt(dev device.T, oldKey, newKey string) error
func (SGPersistDriver) PreemptAbort ¶
func (t SGPersistDriver) PreemptAbort(dev device.T, oldKey, newKey string) error
func (SGPersistDriver) ReadFullStatus ¶
func (t SGPersistDriver) ReadFullStatus(dev device.T) ([]FullStatusEntry, error)
ReadFullStatus reads the full status of the reservation of the device on the first path answering.
func (SGPersistDriver) ReadRegistrations ¶
func (t SGPersistDriver) ReadRegistrations(dev device.T) ([]string, error)
ReadRegistrations read the reservation from any operating path
func (SGPersistDriver) ReadReservation ¶
func (t SGPersistDriver) ReadReservation(dev device.T) (string, error)
func (SGPersistDriver) Unregister ¶
func (t SGPersistDriver) Unregister(dev device.T, key string) error