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
- Variables
- func Add(mgr manager.Manager) error
- func RequestForMigration(a handler.MapObject) (list []reconcile.Request)
- type DataVolume
- type HostPredicate
- type ImportMap
- type KubeVirt
- type Migration
- type MigrationPredicate
- type PlanPredicate
- type Predicate
- type ProviderPredicate
- type Reconciler
- type VmImport
Constants ¶
const ( // Controller name. Name = "plan" // Fast re-queue delay. FastReQ = time.Millisecond * 100 // Slow re-queue delay. SlowReQ = time.Second * 3 )
const ( NoReQ = time.Duration(0) PollReQ = time.Second * 3 )
Requeue
const ( PreHook = "PreHook" PostHook = "PostHook" )
Status pipeline/progress steps.
const ( Started = "Started" CreatePreHook = "CreatePreHook" PreHookCreated = "PreHookCreated" CreateImport = "CreateImport" ImportCreated = "ImportCreated" CreatePostHook = "CreatePostHook" PostHookCreated = "PostHookCreated" Completed = "Completed" )
Phases.
const ( DiskTransfer = "DiskTransfer" ImageConversion = "ImageConversion" )
Steps.
const ( HostNotReady = "HostNotReady" VMNotValid = "VMNotValid" DuplicateVM = "DuplicateVM" DupTargetName = "DuplicateTargetName" Executing = "Executing" Succeeded = "Succeeded" Failed = "Failed" )
Types
const ( Required = libcnd.Required Advisory = libcnd.Advisory Critical = libcnd.Critical Error = libcnd.Error Warn = libcnd.Warn )
Categories
const ( NotSet = "NotSet" NotFound = "NotFound" NotUnique = "NotUnique" Ambiguous = "Ambiguous" )
Reasons
const ( True = libcnd.True False = libcnd.False )
Statuses
Variables ¶
var ( HasPreHook libitr.Flag = 0x01 HasPostHook libitr.Flag = 0x02 )
Predicates.
var Settings = &settings.Settings
Application settings.
Functions ¶
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 ¶
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 KubeVirt ¶
type KubeVirt struct { *plancontext.Context // Builder Builder builder.Builder }
Represents kubevirt.
func (*KubeVirt) EnsureImport ¶
Create the VMIO CR on the destination.
func (*KubeVirt) EnsureNamespace ¶
Ensure the namespace exists on the destination.
func (*KubeVirt) EnsureSecret ¶
Ensure the VMIO secret exists on the destination.
func (*KubeVirt) ListImports ¶
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.
type MigrationPredicate ¶
func (MigrationPredicate) Create ¶
func (r MigrationPredicate) Create(e event.CreateEvent) bool
func (MigrationPredicate) Delete ¶
func (r MigrationPredicate) Delete(e event.DeleteEvent) bool
func (MigrationPredicate) Generic ¶
func (r MigrationPredicate) Generic(e event.GenericEvent) bool
func (MigrationPredicate) Update ¶
func (r MigrationPredicate) Update(e event.UpdateEvent) bool
type PlanPredicate ¶
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.
type ProviderPredicate ¶
func (ProviderPredicate) Create ¶
func (r ProviderPredicate) Create(e event.CreateEvent) bool
func (ProviderPredicate) Delete ¶
func (r ProviderPredicate) Delete(e event.DeleteEvent) bool
func (ProviderPredicate) Generic ¶
func (r ProviderPredicate) Generic(e event.GenericEvent) bool
func (ProviderPredicate) Update ¶
func (r ProviderPredicate) Update(e event.UpdateEvent) bool
type Reconciler ¶
type Reconciler struct { record.EventRecorder client.Client // contains filtered or unexported fields }
Reconciles a Plan object.
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 ¶
Convert the progress annotation into an int64.