diff --git a/pkg/controller/plan/kubevirt.go b/pkg/controller/plan/kubevirt.go index 4afa58a5d..af44af2a1 100644 --- a/pkg/controller/plan/kubevirt.go +++ b/pkg/controller/plan/kubevirt.go @@ -661,7 +661,7 @@ func (r *KubeVirt) getDVs(vm *plan.VMStatus) (edvs []ExtendedDataVolume, err err context.TODO(), dvsList, &client.ListOptions{ - LabelSelector: k8slabels.SelectorFromSet(r.vmLabels(vm.Ref)), + LabelSelector: k8slabels.SelectorFromSet(r.vmAllButMigrationLabels(vm.Ref)), Namespace: r.Plan.Spec.TargetNamespace, }) diff --git a/pkg/controller/plan/migration.go b/pkg/controller/plan/migration.go index 122ebffb2..f3c9e0530 100644 --- a/pkg/controller/plan/migration.go +++ b/pkg/controller/plan/migration.go @@ -458,6 +458,9 @@ func (r *Migration) cleanup(vm *plan.VMStatus, failOnErr func(error) bool) error if err := r.deletePopulatorPVCs(vm); failOnErr(err) { return err } + if err := r.kubevirt.DeleteDataVolumes(vm); failOnErr(err) { + return err + } } if err := r.deleteImporterPods(vm); failOnErr(err) { return err diff --git a/pkg/controller/plan/scheduler/vsphere/scheduler.go b/pkg/controller/plan/scheduler/vsphere/scheduler.go index 6d59be80b..82cb722b8 100644 --- a/pkg/controller/plan/scheduler/vsphere/scheduler.go +++ b/pkg/controller/plan/scheduler/vsphere/scheduler.go @@ -226,9 +226,9 @@ func (r *Scheduler) cost(vm *model.VM, vmStatus *plan.VMStatus) int { func (r *Scheduler) finishedDisks(vmStatus *plan.VMStatus) int { var resp = 0 for _, step := range vmStatus.Pipeline { - if step.Name == "DiskTransfer" { + if step.Name == DiskTransfer { for _, task := range step.Tasks { - if task.Phase == "Completed" { + if task.Phase == Completed { resp += 1 } } diff --git a/pkg/controller/plan/scheduler/vsphere/scheduler_test.go b/pkg/controller/plan/scheduler/vsphere/scheduler_test.go index ffeef6fdc..8cba74b0b 100644 --- a/pkg/controller/plan/scheduler/vsphere/scheduler_test.go +++ b/pkg/controller/plan/scheduler/vsphere/scheduler_test.go @@ -83,6 +83,9 @@ func TestScheduler(t *testing.T) { }, }, hostC: { + { + cost: 11, + }, { cost: 1, }, diff --git a/pkg/controller/provider/container/vsphere/model.go b/pkg/controller/provider/container/vsphere/model.go index d2ced951e..2de398c2e 100644 --- a/pkg/controller/provider/container/vsphere/model.go +++ b/pkg/controller/provider/container/vsphere/model.go @@ -3,6 +3,7 @@ package vsphere import ( "net/url" "sort" + "strconv" "strings" model "github.com/konveyor/forklift-controller/pkg/controller/provider/model/vsphere" @@ -610,6 +611,14 @@ func (v *VmAdapter) Apply(u types.ObjectUpdate) { if s, cast := opt.Value.(string); cast { v.model.NumaNodeAffinity = strings.Split(s, ",") } + case "ctkEnabled": + if s, cast := opt.Value.(string); cast { + boolVal, err := strconv.ParseBool(s) + if err != nil { + return + } + v.model.ChangeTrackingEnabled = boolVal + } } } } diff --git a/pkg/lib/condition/condition.go b/pkg/lib/condition/condition.go index e65f302aa..6debe04ae 100644 --- a/pkg/lib/condition/condition.go +++ b/pkg/lib/condition/condition.go @@ -35,6 +35,8 @@ const ( ValidatingVDDK = "ValidatingVDDK" // Missing IPs on vm pending condition VMMissingGuestIPs = "VMMissingGuestIPs" + // Missing Changed Block + VMMissingChangedBlockTracking = "VMMissingChangedBlockTracking" ) // Condition @@ -319,7 +321,7 @@ func (r *Conditions) HasBlockerCondition() bool { // The collection contains blocker conditions that keep the plan reconciling. func (r *Conditions) HasReQCondition() bool { - return r.HasCondition(ValidatingVDDK) || r.HasCondition(VMMissingGuestIPs) + return r.HasCondition(ValidatingVDDK) || r.HasCondition(VMMissingGuestIPs) || r.HasCondition(VMMissingChangedBlockTracking) } // The collection contains the `Ready` condition.