Skip to content

Commit

Permalink
MTV-1693 | Ignore missing PVC prime
Browse files Browse the repository at this point in the history
Issue: The migration fails on cluster with 4.14 CNV CDI. The 4.14 CNV
CDI does not use prime PVC but uses the DV id.
Error:
```
persistentvolumeclaims prime-b9d0f99b-4e02-469e-83e2-74dbb186531b not found
```

Fix: Try to fetch the prime pvc but if it fails use the original name
and ignore error. This way it will be backwards compatible and support
the new prime PVC case.

Ref: https://issues.redhat.com/browse/MTV-1693

Signed-off-by: Martin Necas <[email protected]>
  • Loading branch information
mnecas committed Nov 26, 2024
1 parent b75f9ab commit 7af181b
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions pkg/controller/plan/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"github.com/konveyor/forklift-controller/pkg/settings"
batchv1 "k8s.io/api/batch/v1"
core "k8s.io/api/core/v1"
k8serr "k8s.io/apimachinery/pkg/api/errors"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/types"
Expand Down Expand Up @@ -1626,23 +1627,27 @@ 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)
importer, found, kErr = r.kubevirt.GetImporterPod(*pvc)
}

if kErr != nil {
Expand Down

0 comments on commit 7af181b

Please sign in to comment.