From 1e0fc77e4d63e2646f690962976fcdd88d3c4424 Mon Sep 17 00:00:00 2001 From: Shubham Pampattiwar Date: Thu, 26 Oct 2023 06:39:38 -0700 Subject: [PATCH] Fix issue 6913 (#6914) add changelog file keep canceling phase const fix data download as well address PR feedback minor fixes Signed-off-by: Shubham Pampattiwar --- changelogs/unreleased/6914-shubham-pampattiwar | 1 + pkg/controller/data_download_controller.go | 4 ++-- pkg/controller/data_upload_controller.go | 12 +++++++----- 3 files changed, 10 insertions(+), 7 deletions(-) create mode 100644 changelogs/unreleased/6914-shubham-pampattiwar diff --git a/changelogs/unreleased/6914-shubham-pampattiwar b/changelogs/unreleased/6914-shubham-pampattiwar new file mode 100644 index 000000000..c95688b39 --- /dev/null +++ b/changelogs/unreleased/6914-shubham-pampattiwar @@ -0,0 +1 @@ +Fix issue 6913: Velero Built-in Datamover: Backup stucks in phase WaitingForPluginOperations when Node Agent pod gets restarted \ No newline at end of file diff --git a/pkg/controller/data_download_controller.go b/pkg/controller/data_download_controller.go index cc60cacef..0212fa00f 100644 --- a/pkg/controller/data_download_controller.go +++ b/pkg/controller/data_download_controller.go @@ -287,12 +287,13 @@ func (r *DataDownloadReconciler) Reconcile(ctx context.Context, req ctrl.Request } else if dd.Status.Phase == velerov2alpha1api.DataDownloadPhaseInProgress { log.Info("Data download is in progress") if dd.Spec.Cancel { + log.Info("Data download is being canceled") fsRestore := r.dataPathMgr.GetAsyncBR(dd.Name) if fsRestore == nil { + r.OnDataDownloadCancelled(ctx, dd.GetNamespace(), dd.GetName()) return ctrl.Result{}, nil } - log.Info("Data download is being canceled") // Update status to Canceling. original := dd.DeepCopy() dd.Status.Phase = velerov2alpha1api.DataDownloadPhaseCanceling @@ -300,7 +301,6 @@ func (r *DataDownloadReconciler) Reconcile(ctx context.Context, req ctrl.Request log.WithError(err).Error("error updating data download status") return ctrl.Result{}, err } - fsRestore.Cancel() return ctrl.Result{}, nil } diff --git a/pkg/controller/data_upload_controller.go b/pkg/controller/data_upload_controller.go index 79468ca04..11c4a0f23 100644 --- a/pkg/controller/data_upload_controller.go +++ b/pkg/controller/data_upload_controller.go @@ -292,13 +292,15 @@ func (r *DataUploadReconciler) Reconcile(ctx context.Context, req ctrl.Request) } else if du.Status.Phase == velerov2alpha1api.DataUploadPhaseInProgress { log.Info("Data upload is in progress") if du.Spec.Cancel { - fsBackup := r.dataPathMgr.GetAsyncBR(du.Name) - if fsBackup == nil { - return ctrl.Result{}, nil - } log.Info("Data upload is being canceled") - // Update status to Canceling. + fsBackup := r.dataPathMgr.GetAsyncBR(du.Name) + if fsBackup == nil { + r.OnDataUploadCancelled(ctx, du.GetNamespace(), du.GetName()) + return ctrl.Result{}, nil + } + + // Update status to Canceling original := du.DeepCopy() du.Status.Phase = velerov2alpha1api.DataUploadPhaseCanceling if err := r.client.Patch(ctx, du, client.MergeFrom(original)); err != nil {