Help us shape the future of Go! Take the 2026 Go Developer Survey

provisioner

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
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)

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 (d *DiskTags) DeleteDiskTags(dev string)

func (*DiskTags) DevExist

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

func (*DiskTags) GetDiskTags

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

func (*DiskTags) Initialized

func (d *DiskTags) Initialized() bool

func (*DiskTags) UpdateDiskTags

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

func (*DiskTags) UpdateInitialized

func (d *DiskTags) UpdateInitialized()

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 NeedMountUpdateOP

type NeedMountUpdateOP int8

func (NeedMountUpdateOP) Has

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)

type Semaphore

type Semaphore struct {
	// contains filtered or unexported fields
}

semaphore is a simple semaphore implementation in channel

func NewSemaphore

func NewSemaphore(n uint) *Semaphore

newSemaphore creates a new semaphore with the given capacity.

Jump to

Keyboard shortcuts

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