Documentation
¶
Index ¶
- Constants
- func ConvertBlockDevicesToMap(bds []*diskv1.BlockDevice) map[string]*diskv1.BlockDevice
- func GetDiskBlockDevice(disk *block.Disk, nodeName, namespace string) *diskv1.BlockDevice
- func GetPartitionBlockDevice(part *block.Partition, nodeName, namespace string) *diskv1.BlockDevice
- func Register(ctx context.Context, nodes ctllonghornv1.NodeController, ...) error
- type Controller
- func (c *Controller) ApplyAutoProvisionFiltersForDisk(disk *block.Disk) bool
- func (c *Controller) ApplyExcludeFiltersForDisk(disk *block.Disk) bool
- func (c *Controller) ApplyExcludeFiltersForPartition(part *block.Partition) bool
- func (c *Controller) MakeGPTPartitionIfNeeded(device *diskv1.BlockDevice) (*diskv1.BlockDevice, error)
- func (c *Controller) OnBlockDeviceChange(key string, device *diskv1.BlockDevice) (*diskv1.BlockDevice, error)
- func (c *Controller) OnBlockDeviceDelete(key string, device *diskv1.BlockDevice) (*diskv1.BlockDevice, error)
- func (c *Controller) SaveBlockDevice(bd *diskv1.BlockDevice, oldBds map[string]*diskv1.BlockDevice, ...) (*diskv1.BlockDevice, error)
- func (c *Controller) ScanBlockDevicesOnNode() error
Constants ¶
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 ConvertBlockDevicesToMap ¶
func ConvertBlockDevicesToMap(bds []*diskv1.BlockDevice) map[string]*diskv1.BlockDevice
ConvertBlockDevicesToMap converts a BlockDeviceList to a map with GUID (Name) as keys.
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.
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
ExcludeFilters []*filter.Filter
AutoGPTGenerate bool
AutoProvisionFilters []*filter.Filter
}
func (*Controller) ApplyAutoProvisionFiltersForDisk ¶ added in v0.3.0
func (c *Controller) 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 (*Controller) ApplyExcludeFiltersForDisk ¶ added in v0.3.0
func (c *Controller) 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 (*Controller) ApplyExcludeFiltersForPartition ¶ added in v0.3.0
func (c *Controller) 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 (*Controller) MakeGPTPartitionIfNeeded ¶
func (c *Controller) MakeGPTPartitionIfNeeded(device *diskv1.BlockDevice) (*diskv1.BlockDevice, error)
MakeGPTPartitionIfNeeded makes GPT partition on given device if needed.
Currently only making GPT partition on devices without a name (GUID).
func (*Controller) OnBlockDeviceChange ¶
func (c *Controller) OnBlockDeviceChange(key 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(key string, device *diskv1.BlockDevice) (*diskv1.BlockDevice, error)
OnBlockDeviceDelete will delete the block devices that belongs to the same parent device
func (*Controller) SaveBlockDevice ¶
func (c *Controller) SaveBlockDevice( bd *diskv1.BlockDevice, oldBds map[string]*diskv1.BlockDevice, autoProvisioned bool, ) (*diskv1.BlockDevice, error)
SaveBlockDevice persists the blockedevice information. If oldBds contains a blockedevice under the same name (GUID), it will only do an update, otherwise create a new one.
Note that this method also activate the device if it's previously inactive.
func (*Controller) ScanBlockDevicesOnNode ¶
func (c *Controller) ScanBlockDevicesOnNode() error
ScanBlockDevicesOnNode scans block devices on the node, and it will either create or update them.