From ea33f0369ca2a3af6603f5bcf986c0fe0abdbcbf Mon Sep 17 00:00:00 2001 From: Martin Necas Date: Sat, 23 Nov 2024 17:11:00 +0100 Subject: [PATCH] MTV-1627 --- pkg/controller/plan/migration.go | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/pkg/controller/plan/migration.go b/pkg/controller/plan/migration.go index 971be28b9..db39cdf42 100644 --- a/pkg/controller/plan/migration.go +++ b/pkg/controller/plan/migration.go @@ -5,6 +5,7 @@ import ( "errors" "fmt" "io" + k8serr "k8s.io/apimachinery/pkg/api/errors" "net/http" "path" "regexp" @@ -1626,23 +1627,29 @@ func (r *Migration) updateCopyProgress(vm *plan.VMStatus, step *plan.Step) (err path.Join(dv.Namespace, dv.Name)) continue } - primePvc := &core.PersistentVolumeClaim{} err = r.Destination.Client.Get(context.TODO(), types.NamespacedName{ Namespace: r.Plan.Spec.TargetNamespace, Name: fmt.Sprintf("prime-%s", pvc.UID), - }, primePvc) + }, pvc) if err != nil { - log.Error( - err, - "Could not get prime PVC for DataVolume.", - "vm", - vm.String(), - "dv", - path.Join(dv.Namespace, dv.Name)) - continue + if k8serr.IsNotFound(err) { + log.Info("Could not find prime PVC") + // Ignore error + err = nil + } else { + log.Error( + err, + "Could not get prime PVC for DataVolume.", + "vm", + vm.String(), + "dv", + path.Join(dv.Namespace, dv.Name)) + continue + } } - - importer, found, kErr = r.kubevirt.GetImporterPod(*primePvc) + fmt.Println("pvc.Name") + fmt.Println(pvc.Name) + importer, found, kErr = r.kubevirt.GetImporterPod(*pvc) } if kErr != nil {