Documentation
¶
Index ¶
- Constants
- Variables
- func PathExists(fs afero.Fs, path string) (bool, error)
- type Client
- func (c *Client) CloseLUKSDevice(ctx context.Context, devicePath string) error
- func (c *Client) EnsureDeviceReadable(ctx context.Context, device string) error
- func (c *Client) EnsureLUKSDeviceClosed(ctx context.Context, devicePath string) error
- func (c *Client) EnsureLUKSDeviceClosedWithMaxWaitLimit(ctx context.Context, luksDevicePath string) error
- func (c *Client) FindDevicesForMultipathDevice(ctx context.Context, device string) []string
- func (c *Client) FindMultipathDeviceForDevice(ctx context.Context, device string) string
- func (c *Client) FlushDevice(ctx context.Context, deviceInfo *models.ScsiDeviceInfo, force bool) error
- func (c *Client) FlushOneDevice(ctx context.Context, devicePath string) error
- func (c *Client) GetDeviceFSType(ctx context.Context, device string) (string, error)
- func (c *Client) GetLUKSDeviceForMultipathDevice(multipathDevice string) (string, error)
- func (c *Client) GetLunSerial(ctx context.Context, path string) (string, error)
- func (c *Client) GetMultipathDeviceBySerial(ctx context.Context, hexSerial string) (string, error)
- func (c *Client) GetMultipathDeviceDisks(ctx context.Context, multipathDevicePath string) ([]string, error)
- func (c *Client) GetMultipathDeviceUUID(multipathDevicePath string) (string, error)
- func (c *Client) IsDeviceUnformatted(ctx context.Context, device string) (bool, error)
- func (c *Client) ListAllDevices(ctx context.Context)
- func (c *Client) MultipathFlushDevice(ctx context.Context, deviceInfo *models.ScsiDeviceInfo) error
- func (c *Client) RemoveDevice(ctx context.Context, devices []string, ignoreErrors bool) error
- func (c *Client) RemoveMultipathDeviceMapping(ctx context.Context, devicePath string) error
- func (c *Client) RemoveMultipathDeviceMappingWithRetries(ctx context.Context, devicePath string, retries uint64, sleep time.Duration) error
- func (c *Client) ScanTargetLUN(ctx context.Context, deviceAddresses []models.ScsiDeviceAddress) error
- func (c *Client) VerifyMultipathDevice(ctx context.Context, publishInfo *models.VolumePublishInfo, ...) (bool, error)
- func (c *Client) VerifyMultipathDeviceSize(ctx context.Context, multipathDevice, device string) (int64, bool, error)
- func (c *Client) WaitForDevice(ctx context.Context, device string) error
- func (c *Client) WaitForDevicesRemoval(ctx context.Context, devicePathPrefix string, deviceNames []string, ...) error
- type Devices
- type DiskSizeGetter
- type SizeGetter
Constants ¶
const ( DevPrefix = "/dev/" DevMapperRoot = "/dev/mapper/" )
Variables ¶
var (
LuksCloseDurations = durations.TimeDuration{}
)
Functions ¶
Types ¶
type Client ¶
type Client struct { SizeGetter // contains filtered or unexported fields }
func NewDetailed ¶
func (*Client) CloseLUKSDevice ¶
CloseLUKSDevice performs a luksClose on the device at the specified path (example: "/dev/mapper/<luks>").
func (*Client) EnsureDeviceReadable ¶
EnsureDeviceReadable reads first 4 KiBs of the device to ensures it is readable
func (*Client) EnsureLUKSDeviceClosed ¶
EnsureLUKSDeviceClosed ensures there is no open LUKS device at the specified path (example: "/dev/mapper/<luks>").
func (*Client) EnsureLUKSDeviceClosedWithMaxWaitLimit ¶
func (*Client) FindDevicesForMultipathDevice ¶
FindDevicesForMultipathDevice finds the constituent devices for a devicemapper parent device like /dev/dm-0.
func (*Client) FindMultipathDeviceForDevice ¶
FindMultipathDeviceForDevice finds the devicemapper parent of a device name like /dev/sdx.
func (*Client) FlushDevice ¶
func (c *Client) FlushDevice(ctx context.Context, deviceInfo *models.ScsiDeviceInfo, force bool) error
flushDevice flushes any outstanding I/O to all paths to a device.
func (*Client) FlushOneDevice ¶
FlushOneDevice flushes any outstanding I/O to a disk
func (*Client) GetDeviceFSType ¶
GetDeviceFSType returns the filesystem for the supplied device.
func (*Client) GetLUKSDeviceForMultipathDevice ¶
func (*Client) GetLunSerial ¶
GetLunSerial get Linux's idea of what the LUN serial number is
func (*Client) GetMultipathDeviceBySerial ¶
GetMultipathDeviceBySerial find DM device whose UUID /sys/block/dmX/dm/uuid contains serial in hex format.
func (*Client) GetMultipathDeviceDisks ¶
func (c *Client) GetMultipathDeviceDisks( ctx context.Context, multipathDevicePath string, ) ([]string, error)
GetMultipathDeviceDisks find the /sys/block/dmX/slaves/sdX disks.
func (*Client) GetMultipathDeviceUUID ¶
GetMultipathDeviceUUID find the /sys/block/dmX/dm/uuid UUID that contains DM device serial in hex format.
func (*Client) IsDeviceUnformatted ¶
IsDeviceUnformatted reads first 2 MiBs of the device to identify if it is unformatted and contains all zeros
func (*Client) ListAllDevices ¶
ListAllDevices logs info about session and what devices are present
func (*Client) MultipathFlushDevice ¶
MultipathFlushDevice invokes the 'multipath' commands to flush paths for a single device.
func (*Client) RemoveDevice ¶
removeDevice tells Linux that a device will be removed.
func (*Client) RemoveMultipathDeviceMapping ¶
RemoveMultipathDeviceMapping uses "multipath -f <devicePath>" to flush(remove) unused map. Unused maps can happen when Unstage is called on offline/deleted LUN.
func (*Client) RemoveMultipathDeviceMappingWithRetries ¶
func (c *Client) RemoveMultipathDeviceMappingWithRetries(ctx context.Context, devicePath string, retries uint64, sleep time.Duration, ) error
RemoveMultipathDeviceMappingWithRetries calls RemoveMultipathDeviceMapping with retries.
func (*Client) ScanTargetLUN ¶
func (c *Client) ScanTargetLUN(ctx context.Context, deviceAddresses []models.ScsiDeviceAddress) error
ScanTargetLUN scans a single LUN or all the LUNs on an iSCSI target to discover it. If all the LUNs are to be scanned please pass -1 for lunID.
func (*Client) VerifyMultipathDevice ¶
func (c *Client) VerifyMultipathDevice( ctx context.Context, publishInfo *models.VolumePublishInfo, allPublishInfos []models.VolumePublishInfo, deviceInfo *models.ScsiDeviceInfo, ) (bool, error)
VerifyMultipathDevice verifies that device being removed is correct based on published device path, device serial number (if present) or comparing all publications (allPublishInfos) for LUN number uniqueness.
func (*Client) VerifyMultipathDeviceSize ¶
func (c *Client) VerifyMultipathDeviceSize( ctx context.Context, multipathDevice, device string, ) (int64, bool, error)
VerifyMultipathDeviceSize compares the size of the DM device with the size of a device to ensure correct DM device has the correct size.
func (*Client) WaitForDevice ¶
WaitForDevice accepts a device name and checks if it is present
type Devices ¶
type Devices interface { FlushDevice(ctx context.Context, deviceInfo *models.ScsiDeviceInfo, force bool) error FlushOneDevice(ctx context.Context, devicePath string) error EnsureDeviceReadable(ctx context.Context, device string) error IsDeviceUnformatted(ctx context.Context, device string) (bool, error) ListAllDevices(ctx context.Context) WaitForDevice(ctx context.Context, device string) error GetDeviceFSType(ctx context.Context, device string) (string, error) FindMultipathDeviceForDevice(ctx context.Context, device string) string FindDevicesForMultipathDevice(ctx context.Context, device string) []string VerifyMultipathDeviceSize(ctx context.Context, multipathDevice, device string) (int64, bool, error) GetDiskSize(ctx context.Context, devicePath string) (int64, error) MultipathFlushDevice(ctx context.Context, deviceInfo *models.ScsiDeviceInfo) error RemoveDevice(ctx context.Context, devices []string, ignoreErrors bool) error VerifyMultipathDevice( ctx context.Context, publishInfo *models.VolumePublishInfo, allPublishInfos []models.VolumePublishInfo, deviceInfo *models.ScsiDeviceInfo, ) (bool, error) GetLunSerial(ctx context.Context, path string) (string, error) GetMultipathDeviceUUID(multipathDevicePath string) (string, error) GetLUKSDeviceForMultipathDevice(multipathDevice string) (string, error) ScanTargetLUN(ctx context.Context, deviceAddresses []models.ScsiDeviceAddress) error CloseLUKSDevice(ctx context.Context, devicePath string) error EnsureLUKSDeviceClosedWithMaxWaitLimit(ctx context.Context, luksDevicePath string) error EnsureLUKSDeviceClosed(ctx context.Context, devicePath string) error RemoveMultipathDeviceMapping(ctx context.Context, devicePath string) error WaitForDevicesRemoval(ctx context.Context, devicePathPrefix string, deviceNames []string, maxWaitTime time.Duration, ) error RemoveMultipathDeviceMappingWithRetries(ctx context.Context, devicePath string, retries uint64, sleep time.Duration) error }
type DiskSizeGetter ¶
type DiskSizeGetter struct{}
func NewDiskSizeGetter ¶
func NewDiskSizeGetter() *DiskSizeGetter
func (*DiskSizeGetter) GetDiskSize ¶
GetDiskSize queries the current block size in bytes