blockdevice

package
v0.1.26 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ZpoolImportAll added in v0.1.5

func ZpoolImportAll(log logr.Logger) (bool, error)

Types

type BlockDevice

type BlockDevice interface {
	// Create the block device (e.g., LVM pvcreate, vgcreate, and lvcreate)
	Create(ctx context.Context, complete bool) (bool, error)

	// Destroy the block device (e.g., LVM pvremove, vgremove, and lvremove)
	Destroy(ctx context.Context) (bool, error)

	// Activate the block device (e.g., LVM lockstart and lvchange --activate y)
	Activate(ctx context.Context) (bool, error)

	// Deactivate the block device (e.g., LVM lockstop and lvchange --activate n)
	Deactivate(ctx context.Context, full bool) (bool, error)

	// Check if the block device exists
	CheckExists(ctx context.Context) (bool, error)

	// Check if the block device is healthy
	CheckHealth(ctx context.Context) (bool, error)

	// CheckReady checks whether the block device is ready to be used
	CheckReady(ctx context.Context) (bool, error)

	// Check if the block device has already been formatted for a file system
	CheckFormatted() (bool, error)

	// Repair the device if possible
	Repair(ctx context.Context) error

	// Get device /dev path
	GetDevice() string
}

type Lvm

type Lvm struct {
	Log         logr.Logger
	CommandArgs LvmCommandArgs

	PhysicalVolumes []*lvm.PhysicalVolume
	VolumeGroup     *lvm.VolumeGroup
	LogicalVolume   *lvm.LogicalVolume
}

func (*Lvm) Activate

func (l *Lvm) Activate(ctx context.Context) (bool, error)

Activate the LVM

func (*Lvm) CheckExists added in v0.1.16

func (l *Lvm) CheckExists(ctx context.Context) (bool, error)

func (*Lvm) CheckFormatted

func (l *Lvm) CheckFormatted() (bool, error)

CheckFormatted checks the LVM to determine if a filesystem has been created there.

func (*Lvm) CheckHealth added in v0.1.26

func (l *Lvm) CheckHealth(ctx context.Context) (bool, error)

func (*Lvm) CheckReady added in v0.1.26

func (l *Lvm) CheckReady(ctx context.Context) (bool, error)

func (*Lvm) Create

func (l *Lvm) Create(ctx context.Context, complete bool) (bool, error)

Create an LVM Device

func (*Lvm) Deactivate

func (l *Lvm) Deactivate(ctx context.Context, full bool) (bool, error)

Deactivate the LVM

func (*Lvm) Destroy

func (l *Lvm) Destroy(ctx context.Context) (bool, error)

Destroy the LVM

func (*Lvm) GetDevice

func (l *Lvm) GetDevice() string

GetDevice generates the name used in /dev/mapper for the vg/lv

func (*Lvm) Repair added in v0.1.26

func (l *Lvm) Repair(ctx context.Context) (err error)

type LvmCommandArgs

type LvmCommandArgs struct {
	PvArgs LvmPvCommandArgs
	VgArgs LvmVgCommandArgs
	LvArgs LvmLvCommandArgs
}

type LvmLvCommandArgs

type LvmLvCommandArgs struct {
	Create     string
	Remove     string
	Activate   string
	Deactivate string
	Repair     string
}

type LvmPvCommandArgs

type LvmPvCommandArgs struct {
	Create string
	Remove string
}

type LvmVgCommandArgs

type LvmVgCommandArgs struct {
	Create    string
	Remove    string
	LockStart string
	LockStop  string
	Extend    string
	Reduce    string
}

type MockBlockDevice

type MockBlockDevice struct {
	Log logr.Logger
}

func (*MockBlockDevice) Activate

func (m *MockBlockDevice) Activate(ctx context.Context) (bool, error)

func (*MockBlockDevice) CheckExists added in v0.1.16

func (m *MockBlockDevice) CheckExists(ctx context.Context) (bool, error)

func (*MockBlockDevice) CheckFormatted

func (m *MockBlockDevice) CheckFormatted() (bool, error)

func (*MockBlockDevice) CheckHealth added in v0.1.26

func (m *MockBlockDevice) CheckHealth(ctx context.Context) (bool, error)

func (*MockBlockDevice) CheckReady added in v0.1.26

func (m *MockBlockDevice) CheckReady(ctx context.Context) (bool, error)

func (*MockBlockDevice) Create

func (m *MockBlockDevice) Create(ctx context.Context, complete bool) (bool, error)

func (*MockBlockDevice) Deactivate

func (m *MockBlockDevice) Deactivate(ctx context.Context, full bool) (bool, error)

func (*MockBlockDevice) Destroy

func (m *MockBlockDevice) Destroy(ctx context.Context) (bool, error)

func (*MockBlockDevice) GetDevice

func (m *MockBlockDevice) GetDevice() string

func (*MockBlockDevice) Repair added in v0.1.26

func (m *MockBlockDevice) Repair(ctx context.Context) error

type Zpool

type Zpool struct {
	Log         logr.Logger
	CommandArgs ZpoolCommandArgs

	Devices []string
	Name    string
	DataSet string
}

func (*Zpool) Activate

func (z *Zpool) Activate(ctx context.Context) (bool, error)

func (*Zpool) CheckExists added in v0.1.16

func (z *Zpool) CheckExists(ctx context.Context) (bool, error)

func (*Zpool) CheckFormatted

func (z *Zpool) CheckFormatted() (bool, error)

func (*Zpool) CheckHealth added in v0.1.26

func (z *Zpool) CheckHealth(ctx context.Context) (bool, error)

func (*Zpool) CheckReady added in v0.1.26

func (z *Zpool) CheckReady(ctx context.Context) (bool, error)

func (*Zpool) Create

func (z *Zpool) Create(ctx context.Context, complete bool) (bool, error)

func (*Zpool) Deactivate

func (z *Zpool) Deactivate(ctx context.Context, full bool) (bool, error)

func (*Zpool) Destroy

func (z *Zpool) Destroy(ctx context.Context) (bool, error)

func (*Zpool) GetDevice

func (z *Zpool) GetDevice() string

func (*Zpool) Repair added in v0.1.26

func (z *Zpool) Repair(ctx context.Context) error

type ZpoolCommandArgs

type ZpoolCommandArgs struct {
	Create  string
	Replace string

	Vars map[string]string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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