From 159ac1d7518b110943094b81940ee5d187b9257d Mon Sep 17 00:00:00 2001 From: Bella Khizgiyaev Date: Tue, 21 May 2024 15:41:36 +0300 Subject: [PATCH] OVA: Change connection refuse check for virt-v2v vm configuretion server Signed-off-by: Bella Khizgiyaev --- pkg/controller/plan/kubevirt.go | 4 ++-- pkg/controller/plan/migration.go | 15 +++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/pkg/controller/plan/kubevirt.go b/pkg/controller/plan/kubevirt.go index 205b6cbde..3301070d3 100644 --- a/pkg/controller/plan/kubevirt.go +++ b/pkg/controller/plan/kubevirt.go @@ -12,7 +12,6 @@ import ( "sort" "strconv" "strings" - "syscall" "time" api "github.com/konveyor/forklift-controller/pkg/apis/forklift/v1beta1" @@ -910,7 +909,7 @@ func (r *KubeVirt) UpdateVmByConvertedConfig(vm *plan.VMStatus, pod *core.Pod, s */ resp, err := http.Get(url) if err != nil { - if err == syscall.ECONNREFUSED { + if strings.Contains(err.Error(), "connection refused") { err = nil } return @@ -941,6 +940,7 @@ func (r *KubeVirt) UpdateVmByConvertedConfig(vm *plan.VMStatus, pod *core.Pod, s err = nil } } + step.MarkCompleted() return } diff --git a/pkg/controller/plan/migration.go b/pkg/controller/plan/migration.go index 714b9770d..788ce10c8 100644 --- a/pkg/controller/plan/migration.go +++ b/pkg/controller/plan/migration.go @@ -1118,6 +1118,12 @@ func (r *Migration) execute(vm *plan.VMStatus) (err error) { } step.MarkStarted() step.Phase = Running + + err = r.updateConversionProgress(vm, step) + if err != nil { + return + } + // only for OVA, fetch config from the conversion pod if r.Source.Provider.Type() == v1beta1.Ova { pod, err := r.kubevirt.GetGuestConversionPod(vm) @@ -1133,11 +1139,6 @@ func (r *Migration) execute(vm *plan.VMStatus) (err error) { } } - err = r.updateConversionProgress(vm, step) - if err != nil { - return - } - if step.MarkedCompleted() && !step.HasError() { step.Phase = Completed vm.Phase = r.next(vm.Phase) @@ -1698,7 +1699,9 @@ func (r *Migration) updateConversionProgressEl9(pod *core.Pod, step *plan.Step) if step.Name == ImageConversion && someProgress { // Disk copying has already started. Transition from // ConvertGuest to CopyDisksVirtV2V . - step.MarkCompleted() + if r.Source.Provider.Type() == v1beta1.VSphere { + step.MarkCompleted() + } step.Progress.Completed = step.Progress.Total return }