Documentation
¶
Index ¶
- Constants
- Variables
- func GetDiskBlockDevice(disk *block.Disk, nodeName, namespace string) *diskv1.BlockDevice
- func Register(ctx context.Context, nodes ctllonghornv1.NodeController, ...) error
- type Controller
- func (c *Controller) OnBlockDeviceChange(_ string, device *diskv1.BlockDevice) (*diskv1.BlockDevice, error)
- func (c *Controller) OnBlockDeviceDelete(_ string, device *diskv1.BlockDevice) (*diskv1.BlockDevice, error)
- func (c *Controller) OnConfigMapChange(_ string, cm *corev1.ConfigMap) (*corev1.ConfigMap, error)
- type NeedMountUpdateOP
- type Scanner
- func (s *Scanner) ApplyAutoProvisionFiltersForDisk(disk *block.Disk) bool
- func (s *Scanner) ApplyExcludeFiltersForDisk(disk *block.Disk) bool
- func (s *Scanner) NeedsAutoProvision(oldBd *diskv1.BlockDevice, autoProvisionPatternMatches bool) bool
- func (s *Scanner) SaveBlockDevice(bd *diskv1.BlockDevice, autoProvisioned bool) (*diskv1.BlockDevice, error)
- func (s *Scanner) Start(ctx context.Context) 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 ¶
var CacheDiskTags *provisioner.DiskTags
Functions ¶
func GetDiskBlockDevice ¶
func GetDiskBlockDevice(disk *block.Disk, nodeName, namespace string) *diskv1.BlockDevice
GetDiskBlockDevice creates a BlockDevices from a given disk. Note that the _name_ of the BlockDevice retuned is not set by this function. The caller must set it before trying to actually create a BD CR based on this, and must take care when comparing BDs.
func Register ¶
func Register( ctx context.Context, nodes ctllonghornv1.NodeController, upgrades ctlharvesterv1.UpgradeController, bds ctldiskv1.BlockDeviceController, lvmVGs ctldiskv1.LVMVolumeGroupController, configMaps k8scorev1.ConfigMapController, 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
UpgradeClient ctlharvesterv1.UpgradeClient
Blockdevices ctldiskv1.BlockDeviceController
BlockdeviceCache ctldiskv1.BlockDeviceCache
BlockInfo block.Info
LVMVgClient ctldiskv1.LVMVolumeGroupController
ConfigMaps k8scorev1.ConfigMapController
// 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
func (*Controller) OnConfigMapChange ¶
OnConfigMapChange watches the ConfigMap changes and triggers disk rescan when filter configuration changes
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
func (f NeedMountUpdateOP) Has(flag NeedMountUpdateOP) bool
type Scanner ¶ added in v0.4.1
type Scanner struct {
NodeName string
Namespace string
UpgradeClient ctlharvesterv1.UpgradeClient
Blockdevices ctldiskv1.BlockDeviceController
BlockInfo block.Info
ExcludeFilters []*filter.Filter
AutoProvisionFilters []*filter.Filter
ConfigMapLoader *filter.ConfigMapLoader
Cond *sync.Cond
Shutdown bool
TerminatedChannels *chan bool
}
func NewScanner ¶ added in v0.4.1
func NewScanner( nodeName, namespace string, upgrades ctlharvesterv1.UpgradeController, bds ctldiskv1.BlockDeviceController, block block.Info, configMapLoader *filter.ConfigMapLoader, cond *sync.Cond, shutdown bool, ch *chan bool, ) *Scanner
func (*Scanner) ApplyAutoProvisionFiltersForDisk ¶ added in v0.4.1
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
ApplyExcludeFiltersForDisk check the status of disk for every registered exclude filters. If the disk 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.