diff --git a/pkg/controller/plan/kubevirt.go b/pkg/controller/plan/kubevirt.go index 44d3e0802..0397a1926 100644 --- a/pkg/controller/plan/kubevirt.go +++ b/pkg/controller/plan/kubevirt.go @@ -1969,19 +1969,20 @@ func (r *KubeVirt) CreatePvcForNfs(pvcName string) (err error) { Name: pvcName, } - if err = wait.PollUntilContextTimeout(context.TODO(), 5*time.Second, 45*time.Second, true, func(ctx context.Context) (done bool, err error) { - err = r.Get(context.TODO(), pvcNamespacedName, pvc) + timeout := 45 * time.Second + ctx, cancel := context.WithTimeout(context.TODO(), timeout) + defer cancel() + + // wait until pvc and pv are bounded. + wait.PollImmediateUntil(5*time.Second, func() (bool, error) { + err := r.Get(context.TODO(), pvcNamespacedName, pvc) if err != nil { r.Log.Error(err, "Failed to get OVA plan PVC") return false, err } return pvc.Status.Phase == "Bound", nil + }, ctx.Done()) - }); err != nil { - r.Log.Error(err, "Failed to bind OVA PVC to PV ") - return - - } return nil }