blockdevice

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ParentDeviceLabel stores the parent device name of a device
	ParentDeviceLabel = "ndm.harvesterhci.io/parent-device"
	// DeviceTypeLabel indicates whether the device is a disk or a partition
	DeviceTypeLabel = "ndm.harvesterhci.io/device-type"
)

Variables

This section is empty.

Functions

func GetDiskBlockDevice

func GetDiskBlockDevice(disk *block.Disk, nodeName, namespace string) *diskv1.BlockDevice

GetDiskBlockDevice gets a blockdevice from a given disk.

func GetPartitionBlockDevice

func GetPartitionBlockDevice(part *block.Partition, nodeName, namespace string) *diskv1.BlockDevice

GetPartitionBlockDevice gets a blockdevice from a given partition.

func Register

func Register(
	ctx context.Context,
	nodes ctllonghornv1.NodeController,
	bds ctldiskv1.BlockDeviceController,
	block block.Info,
	opt *option.Option,
	scanner *Scanner,
) error

Register register the block device CRD controller

Types

type Controller

type Controller struct {
	Namespace string
	NodeName  string

	NodeCache ctllonghornv1.NodeCache
	Nodes     ctllonghornv1.NodeClient

	Blockdevices     ctldiskv1.BlockDeviceController
	BlockdeviceCache ctldiskv1.BlockDeviceCache
	BlockInfo        block.Info
	// contains filtered or unexported fields
}

func (*Controller) OnBlockDeviceChange

func (c *Controller) OnBlockDeviceChange(_ string, device *diskv1.BlockDevice) (*diskv1.BlockDevice, error)

OnBlockDeviceChange watch the block device CR on change and performing disk operations like mounting the disks to a desired path via ext4

func (*Controller) OnBlockDeviceDelete

func (c *Controller) OnBlockDeviceDelete(_ string, device *diskv1.BlockDevice) (*diskv1.BlockDevice, error)

OnBlockDeviceDelete will delete the block devices that belongs to the same parent device

type DiskTags added in v0.6.1

type DiskTags struct {
	// contains filtered or unexported fields
}
var CacheDiskTags *DiskTags

func (*DiskTags) DeleteDiskTags added in v0.6.1

func (d *DiskTags) DeleteDiskTags(dev string)

func (*DiskTags) DevExist added in v0.6.1

func (d *DiskTags) DevExist(dev string) bool

func (*DiskTags) GetDiskTags added in v0.6.1

func (d *DiskTags) GetDiskTags(dev string) []string

func (*DiskTags) Initialized added in v0.6.1

func (d *DiskTags) Initialized() bool

func (*DiskTags) UpdateDiskTags added in v0.6.1

func (d *DiskTags) UpdateDiskTags(dev string, tags []string)

func (*DiskTags) UpdateInitialized added in v0.6.1

func (d *DiskTags) UpdateInitialized()

type NeedMountUpdateOP added in v0.5.0

type NeedMountUpdateOP int8
const (
	NeedMountUpdateNoOp NeedMountUpdateOP = 1 << iota
	NeedMountUpdateMount
	NeedMountUpdateUnmount
)

func (NeedMountUpdateOP) Has added in v0.5.0

type Scanner added in v0.4.1

type Scanner struct {
	NodeName             string
	Namespace            string
	Blockdevices         ctldiskv1.BlockDeviceController
	BlockInfo            block.Info
	ExcludeFilters       []*filter.Filter
	AutoProvisionFilters []*filter.Filter
	Cond                 *sync.Cond
	Shutdown             bool
	TerminatedChannels   *chan bool
}

func NewScanner added in v0.4.1

func NewScanner(
	nodeName, namespace string,
	bds ctldiskv1.BlockDeviceController,
	block block.Info,
	excludeFilters, autoProvisionFilters []*filter.Filter,
	cond *sync.Cond,
	shutdown bool,
	ch *chan bool,
) *Scanner

func (*Scanner) ApplyAutoProvisionFiltersForDisk added in v0.4.1

func (s *Scanner) ApplyAutoProvisionFiltersForDisk(disk *block.Disk) bool

ApplyAutoProvisionFiltersForDisk check the status of disk for every registered auto-provision filters. If the disk meets one of the criteria, it returns true.

func (*Scanner) ApplyExcludeFiltersForDisk added in v0.4.1

func (s *Scanner) ApplyExcludeFiltersForDisk(disk *block.Disk) bool

ApplyExcludeFiltersForPartition check the status of disk for every registered exclude filters. If the disk meets one of the criteria, it returns true.

func (*Scanner) ApplyExcludeFiltersForPartition added in v0.4.1

func (s *Scanner) ApplyExcludeFiltersForPartition(part *block.Partition) bool

ApplyExcludeFiltersForPartition check the status of partition for every registered exclude filters. If the partition meets one of the criteria, it returns true.

func (*Scanner) NeedsAutoProvision added in v0.4.1

func (s *Scanner) NeedsAutoProvision(oldBd *diskv1.BlockDevice, autoProvisionPatternMatches bool) bool

NeedsAutoProvision returns true if the current block device needs to be auto-provisioned.

Criteria: - disk hasn't yet set to provisioned - disk hasn't yet been force formatted - disk matches auto-provisioned patterns

func (*Scanner) SaveBlockDevice added in v0.4.1

func (s *Scanner) SaveBlockDevice(bd *diskv1.BlockDevice, autoProvisioned bool) (*diskv1.BlockDevice, error)

SaveBlockDevice persists the blockedevice information.

func (*Scanner) Start added in v0.4.1

func (s *Scanner) Start() error

Jump to

Keyboard shortcuts

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