plan

package
v0.0.0-...-3c75e53 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2020 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Overview

The Plan CR represents a planned migration of VMs. The plan defines the source and destination providers; the resource mapping and a list of VMs to be migrated. The plan controller watches Migration CRs. Each Migration CR represents a separate and ordered execution of the plan. During plan execution, all validations are suspended. The plan Status.Migration contains a snapshot of the specification (except secrets) which is used during the execution.

Each plan execution:

1. Update the Status.Migration snapshot. 2. Ensure the plan CR namespace exists on the destination. 3. Ensure the CNV Secret exists and configured correctly on the destination. 4. Ensure the CNV ResourceMapping CR exists and configured correctly on the destination. 5. Create a CNV Import CR for each incomplete VM. 6. Requeue the reconcile until all of the VMs have either succeeded or failed. 7. A VM has completed successfully when it reaches the `Complete` phase without an error.

Each plan execution is idempotent. Subsequent migrations will only affect incomplete or failed VM migrations.

Index

Constants

View Source
const (
	// Controller name.
	Name = "plan"
	// Fast re-queue delay.
	FastReQ = time.Millisecond * 100
	// Slow re-queue delay.
	SlowReQ = time.Second * 3
)
View Source
const (
	NoReQ   = time.Duration(0)
	PollReQ = time.Second * 3
)

Requeue

View Source
const (
	PreHook  = "PreHook"
	PostHook = "PostHook"
)

Status pipeline/progress steps.

View Source
const (
	Started         = "Started"
	CreatePreHook   = "CreatePreHook"
	PreHookCreated  = "PreHookCreated"
	CreateImport    = "CreateImport"
	ImportCreated   = "ImportCreated"
	CreatePostHook  = "CreatePostHook"
	PostHookCreated = "PostHookCreated"
	Completed       = "Completed"
)

Phases.

View Source
const (
	DiskTransfer    = "DiskTransfer"
	ImageConversion = "ImageConversion"
)

Steps.

View Source
const (
	HostNotReady  = "HostNotReady"
	VMNotValid    = "VMNotValid"
	DuplicateVM   = "DuplicateVM"
	DupTargetName = "DuplicateTargetName"
	Executing     = "Executing"
	Succeeded     = "Succeeded"
	Failed        = "Failed"
)

Types

View Source
const (
	Required = libcnd.Required
	Advisory = libcnd.Advisory
	Critical = libcnd.Critical
	Error    = libcnd.Error
	Warn     = libcnd.Warn
)

Categories

View Source
const (
	NotSet    = "NotSet"
	NotFound  = "NotFound"
	NotUnique = "NotUnique"
	Ambiguous = "Ambiguous"
)

Reasons

View Source
const (
	True  = libcnd.True
	False = libcnd.False
)

Statuses

Variables

View Source
var (
	HasPreHook  libitr.Flag = 0x01
	HasPostHook libitr.Flag = 0x02
)

Predicates.

View Source
var Settings = &settings.Settings

Application settings.

Functions

func Add

func Add(mgr manager.Manager) error

Creates a new Plan Controller and adds it to the Manager.

func RequestForMigration

func RequestForMigration(a handler.MapObject) (list []reconcile.Request)

Plan request for Migration.

Types

type DataVolume

type DataVolume struct {
	*cdi.DataVolume
}

Represents a CDI DataVolume and add behavior.

func (*DataVolume) Conditions

func (r *DataVolume) Conditions() (cnd *libcnd.Conditions)

Get conditions.

func (*DataVolume) PercentComplete

func (r *DataVolume) PercentComplete() (pct float64)

Convert the Status.Progress into a percentage (float).

type HostPredicate

type HostPredicate struct {
	predicate.Funcs
}

func (HostPredicate) Create

func (r HostPredicate) Create(e event.CreateEvent) bool

func (HostPredicate) Delete

func (r HostPredicate) Delete(e event.DeleteEvent) bool

func (HostPredicate) Generic

func (r HostPredicate) Generic(e event.GenericEvent) bool

func (HostPredicate) Update

func (r HostPredicate) Update(e event.UpdateEvent) bool

type ImportMap

type ImportMap map[string]VmImport

Map of VmImport keyed by vmID.

type KubeVirt

type KubeVirt struct {
	*plancontext.Context
	// Builder
	Builder builder.Builder
}

Represents kubevirt.

func (*KubeVirt) EnsureImport

func (r *KubeVirt) EnsureImport(vm *plan.VMStatus) (err error)

Create the VMIO CR on the destination.

func (*KubeVirt) EnsureNamespace

func (r *KubeVirt) EnsureNamespace() (err error)

Ensure the namespace exists on the destination.

func (*KubeVirt) EnsureSecret

func (r *KubeVirt) EnsureSecret(vmRef ref.Ref) (err error)

Ensure the VMIO secret exists on the destination.

func (*KubeVirt) ImportMap

func (r *KubeVirt) ImportMap() (mp ImportMap, err error)

Build a ImportMap.

func (*KubeVirt) ListImports

func (r *KubeVirt) ListImports() ([]VmImport, error)

List import CRs. Each VmImport represents a VMIO VirtualMachineImport with associated DataVolumes.

type Migration

type Migration struct {
	*plancontext.Context
	// contains filtered or unexported fields
}

Migration.

func (Migration) Run

func (r Migration) Run() (reQ time.Duration, err error)

Run the migration.

func (*Migration) Type

func (r *Migration) Type() string

Type of migration.

type MigrationPredicate

type MigrationPredicate struct {
	predicate.Funcs
}

func (MigrationPredicate) Create

func (MigrationPredicate) Delete

func (MigrationPredicate) Generic

func (MigrationPredicate) Update

type PlanPredicate

type PlanPredicate struct {
	predicate.Funcs
}

func (PlanPredicate) Create

func (r PlanPredicate) Create(e event.CreateEvent) bool

func (PlanPredicate) Delete

func (r PlanPredicate) Delete(e event.DeleteEvent) bool

func (PlanPredicate) Update

func (r PlanPredicate) Update(e event.UpdateEvent) bool

type Predicate

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

Step predicate.

func (*Predicate) Evaluate

func (r *Predicate) Evaluate(flag libitr.Flag) (allowed bool, err error)

Evaluate predicate flags.

type ProviderPredicate

type ProviderPredicate struct {
	predicate.Funcs
}

func (ProviderPredicate) Create

func (ProviderPredicate) Delete

func (ProviderPredicate) Generic

func (ProviderPredicate) Update

type Reconciler

type Reconciler struct {
	record.EventRecorder
	client.Client
	// contains filtered or unexported fields
}

Reconciles a Plan object.

func (*Reconciler) Reconcile

func (r *Reconciler) Reconcile(request reconcile.Request) (reconcile.Result, error)

Reconcile a Plan CR.

type VmImport

type VmImport struct {
	*vmio.VirtualMachineImport
	DataVolumes []DataVolume
}

Represents VMIO VirtualMachineImport with associated DataVolumes.

func (*VmImport) Conditions

func (r *VmImport) Conditions() (cnd *libcnd.Conditions)

Get conditions.

func (*VmImport) Owner

func (r *VmImport) Owner(dv *cdi.DataVolume) bool

Determine if `this` VMIO VirtualMachineImport is the owner of the CDI DataVolume.

func (*VmImport) PercentComplete

func (r *VmImport) PercentComplete() (pct float64)

Convert the progress annotation into an int64.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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