From 55a7807db2d22acf78516346c13b6c59b8ca6cba Mon Sep 17 00:00:00 2001 From: Martin Necas Date: Wed, 9 Oct 2024 09:22:17 +0200 Subject: [PATCH] Fix VMware scheduler test Now we allow migrating with more disks than the MaxInFlight in case there is no VM being migrated at that time. This is done for the user's convenience. Related to: https://github.com/kubev2v/forklift/pull/1087 Signed-off-by: Martin Necas --- pkg/controller/plan/scheduler/vsphere/scheduler.go | 4 ++-- pkg/controller/plan/scheduler/vsphere/scheduler_test.go | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) 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, },