Documentation ¶
Index ¶
- Constants
- func ResolvePersistentDevPath(device *diskv1.BlockDevice) (string, error)
- func SetCondDeviceFormattingFail(device *diskv1.BlockDevice, err error)
- type DiskTags
- type LVMProvisioner
- func (l *LVMProvisioner) Format(devPath string) (isFormatComplete, isRequeueNeeded bool, err error)
- func (l *LVMProvisioner) GetProvisionerName() string
- func (l *LVMProvisioner) Provision() (bool, error)
- func (l *LVMProvisioner) UnFormat() (bool, error)
- func (l *LVMProvisioner) UnProvision() (bool, error)
- func (l *LVMProvisioner) Update() (requeue bool, err error)
- type LonghornV1Provisioner
- func (p *LonghornV1Provisioner) Format(devPath string) (bool, bool, error)
- func (p *LonghornV1Provisioner) GetProvisionerName() string
- func (p *LonghornV1Provisioner) Provision() (bool, error)
- func (p *LonghornV1Provisioner) UnFormat() (bool, error)
- func (p *LonghornV1Provisioner) UnProvision() (bool, error)
- func (p *LonghornV1Provisioner) Update() (bool, error)
- type LonghornV2Provisioner
- func (p *LonghornV2Provisioner) Format(devPath string) (isFormatComplete, isRequeueNeeded bool, err error)
- func (p *LonghornV2Provisioner) Provision() (isRequeueNeeded bool, err error)
- func (p *LonghornV2Provisioner) UnFormat() (isRequeueNeeded bool, err error)
- func (p *LonghornV2Provisioner) UnProvision() (isRequeueNeeded bool, err error)
- func (p *LonghornV2Provisioner) Update() (isRequeueNeeded bool, err error)
- type NeedMountUpdateOP
- type Provisioner
- func NewLHV1Provisioner(device *diskv1.BlockDevice, block block.Info, nodeObj *longhornv1.Node, ...) (Provisioner, error)
- func NewLHV2Provisioner(device *diskv1.BlockDevice, block block.Info, nodeObj *longhornv1.Node, ...) (Provisioner, error)
- func NewLVMProvisioner(vgName, nodeName string, lvmVGs ctldiskv1.LVMVolumeGroupController, ...) (Provisioner, error)
- type Semaphore
Constants ¶
const ( TypeLonghornV1 = "LonghornV1" TypeLonghornV2 = "LonghornV2" TypeLVM = "LVM" // longhorn disk tags ErrorCacheDiskTagsNotInitialized = "CacheDiskTags is not initialized" // longhorn MountStatus NeedMountUpdateNoOp NeedMountUpdateOP = 1 << iota NeedMountUpdateMount NeedMountUpdateUnmount )
Variables ¶
This section is empty.
Functions ¶
func ResolvePersistentDevPath ¶
func ResolvePersistentDevPath(device *diskv1.BlockDevice) (string, error)
ResolvePersistentDevPath tries to determine the currently active short device path (e.g. "/dev/sda") for a given block device. When the scanner first finds a new block device, device.Spec.DevPath is set to the short device path at that time, and device.Status.DeviceStatus.Details is filled in with data that uniquely identifies the device (e.g.: WWN). It's possible that on subsequent reboots, the short path will change, for example if devices are added or removed, so we have this function to try to figure out the _current_ short device path based on the unique identifying information in device.Status.DeviceStatus.Details.
func SetCondDeviceFormattingFail ¶
func SetCondDeviceFormattingFail(device *diskv1.BlockDevice, err error)
Types ¶
type DiskTags ¶
type DiskTags struct {
// contains filtered or unexported fields
}
DiskTags is a cache mechanism for the blockdevices Tags (spec.Tags), it only changed from Harvester side.
func NewLonghornDiskTags ¶
func NewLonghornDiskTags() *DiskTags
func (*DiskTags) DeleteDiskTags ¶
func (*DiskTags) GetDiskTags ¶
func (*DiskTags) Initialized ¶
func (*DiskTags) UpdateDiskTags ¶
func (*DiskTags) UpdateInitialized ¶
func (d *DiskTags) UpdateInitialized()
type LVMProvisioner ¶ added in v0.7.2
type LVMProvisioner struct {
// contains filtered or unexported fields
}
func (*LVMProvisioner) Format ¶ added in v0.7.2
func (l *LVMProvisioner) Format(devPath string) (isFormatComplete, isRequeueNeeded bool, err error)
Format operation on the LVM use to ensure the device is clean and ready to be used by LVM.
func (*LVMProvisioner) GetProvisionerName ¶ added in v0.7.2
func (l *LVMProvisioner) GetProvisionerName() string
func (*LVMProvisioner) Provision ¶ added in v0.7.2
func (l *LVMProvisioner) Provision() (bool, error)
Provision creates (if needed) a LVMVolumeGroup CRD and update the corresponding fields.
func (*LVMProvisioner) UnFormat ¶ added in v0.7.2
func (l *LVMProvisioner) UnFormat() (bool, error)
func (*LVMProvisioner) UnProvision ¶ added in v0.7.2
func (l *LVMProvisioner) UnProvision() (bool, error)
UnProvision update the LVMVolumeGroup CRD and remove the LVMVolumeGroup CRD if the device is the last one in the VG.
func (*LVMProvisioner) Update ¶ added in v0.7.2
func (l *LVMProvisioner) Update() (requeue bool, err error)
type LonghornV1Provisioner ¶
type LonghornV1Provisioner struct {
// contains filtered or unexported fields
}
func (*LonghornV1Provisioner) Format ¶
func (p *LonghornV1Provisioner) Format(devPath string) (bool, bool, error)
func (*LonghornV1Provisioner) GetProvisionerName ¶
func (p *LonghornV1Provisioner) GetProvisionerName() string
func (*LonghornV1Provisioner) Provision ¶
func (p *LonghornV1Provisioner) Provision() (bool, error)
func (*LonghornV1Provisioner) UnFormat ¶
func (p *LonghornV1Provisioner) UnFormat() (bool, error)
func (*LonghornV1Provisioner) UnProvision ¶
func (p *LonghornV1Provisioner) UnProvision() (bool, error)
func (*LonghornV1Provisioner) Update ¶
func (p *LonghornV1Provisioner) Update() (bool, error)
Update is used to update the disk tags
type LonghornV2Provisioner ¶ added in v0.7.2
type LonghornV2Provisioner struct {
*LonghornV1Provisioner
}
func (*LonghornV2Provisioner) Format ¶ added in v0.7.2
func (p *LonghornV2Provisioner) Format(devPath string) (isFormatComplete, isRequeueNeeded bool, err error)
Format should really be a no-op for V2 disks given they just take the whole device, but for NVMe devices where Longhorn decides to use the nvme bdev driver, device activation will fail if there's an existing filesystem on the device, so we need to make sure to wipe before use.
func (*LonghornV2Provisioner) Provision ¶ added in v0.7.2
func (p *LonghornV2Provisioner) Provision() (isRequeueNeeded bool, err error)
Provision adds the block device to longhorn's list of disks. Longhorn's admission webhook will deny the update if the V2 engine isn't enabled (you'll see something like 'admission webhook "validator.longhorn.io" denied the request: update disk on node harvester-node-0 error: The disk 989754e4e66edadfd3390974a1aba3f8(/dev/sda) is a block device, but the SPDK feature is not enabled')
func (*LonghornV2Provisioner) UnFormat ¶ added in v0.7.2
func (p *LonghornV2Provisioner) UnFormat() (isRequeueNeeded bool, err error)
UnFormat is a no-op for V2 disks
func (*LonghornV2Provisioner) UnProvision ¶ added in v0.7.2
func (p *LonghornV2Provisioner) UnProvision() (isRequeueNeeded bool, err error)
func (*LonghornV2Provisioner) Update ¶ added in v0.7.2
func (p *LonghornV2Provisioner) Update() (isRequeueNeeded bool, err error)
type NeedMountUpdateOP ¶
type NeedMountUpdateOP int8
func (NeedMountUpdateOP) Has ¶
func (f NeedMountUpdateOP) Has(flag NeedMountUpdateOP) bool
type Provisioner ¶
type Provisioner interface { // Format is the Prerequisites for the provisioner // You should do the format-related operations (including mkfs, mount ...etc) here // Return values: bool1: isFormatComplete, bool2: isRequeueNeeded, error: error Format(string) (bool, bool, error) // UnFormat is the cleanup operation for the provisioner // You should call this after the UnProvision (if needed) // Return values: bool: isRequeueNeeded, error: error UnFormat() (bool, error) // Provision is the main operation for the provisioner // You should do all provision things like provision to specific storage, add to volume group ...etc // Return values: bool: isRequeueNeeded, error: error Provision() (bool, error) // UnProvision is the cleanup operation for the provisioner // You should cleanup all the things like remove from volume group, unprovision from storage ...etc // Return values: bool: isRequeueNeeded, error: error UnProvision() (bool, error) // Update is the mechanism to update anything you needed. // Like tags on the longhorn nodes, ensure the vg active for LVM ...etc // Return values: bool: isRequeueNeeded, error: error Update() (bool, error) }
func NewLHV1Provisioner ¶
func NewLHV1Provisioner( device *diskv1.BlockDevice, block block.Info, nodeObj *longhornv1.Node, nodesClient ctllonghornv1.NodeClient, nodesClientCache ctllonghornv1.NodeCache, cacheDiskTags *DiskTags, semaphore *Semaphore, ) (Provisioner, error)
func NewLHV2Provisioner ¶ added in v0.7.2
func NewLHV2Provisioner( device *diskv1.BlockDevice, block block.Info, nodeObj *longhornv1.Node, nodesClient ctllonghornv1.NodeClient, nodesClientCache ctllonghornv1.NodeCache, cacheDiskTags *DiskTags, ) (Provisioner, error)
func NewLVMProvisioner ¶ added in v0.7.2
func NewLVMProvisioner(vgName, nodeName string, lvmVGs ctldiskv1.LVMVolumeGroupController, device *diskv1.BlockDevice, blockInfo block.Info, lock *sync.Mutex) (Provisioner, error)