move UpdatePVXStatusToFailed to controller pkg

Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com>
This commit is contained in:
Tiger Kaovilai
2023-02-07 10:53:39 -05:00
parent fce15cf7cf
commit 07c7692e0a
5 changed files with 23 additions and 48 deletions
+2 -4
View File
@@ -52,8 +52,6 @@ import (
"github.com/vmware-tanzu/velero/pkg/cmd/util/signals"
"github.com/vmware-tanzu/velero/pkg/controller"
"github.com/vmware-tanzu/velero/pkg/metrics"
"github.com/vmware-tanzu/velero/pkg/podvolumebackup"
"github.com/vmware-tanzu/velero/pkg/podvolumerestore"
"github.com/vmware-tanzu/velero/pkg/restic"
"github.com/vmware-tanzu/velero/pkg/util/filesystem"
"github.com/vmware-tanzu/velero/pkg/util/logging"
@@ -303,7 +301,7 @@ func (s *resticServer) markInProgressPVBsFailed(client ctrlclient.Client) {
continue
}
if err := podvolumebackup.UpdateStatusToFailed(client, s.ctx, &pvbs.Items[i],
if err := controller.UpdatePVBStatusToFailed(client, s.ctx, &pvbs.Items[i],
fmt.Sprintf("get a podvolumebackup with status %q during the server starting, mark it as %q", velerov1api.PodVolumeBackupPhaseInProgress, velerov1api.PodVolumeBackupPhaseFailed),
time.Now()); err != nil {
s.logger.WithError(errors.WithStack(err)).Errorf("failed to patch podvolumebackup %q", pvb.GetName())
@@ -339,7 +337,7 @@ func (s *resticServer) markInProgressPVRsFailed(client ctrlclient.Client) {
continue
}
if err := podvolumerestore.UpdateStatusToFailed(client, s.ctx, &pvrs.Items[i],
if err := controller.UpdatePVRStatusToFailed(client, s.ctx, &pvrs.Items[i],
fmt.Sprintf("get a podvolumerestore with status %q during the server starting, mark it as %q", velerov1api.PodVolumeRestorePhaseInProgress, velerov1api.PodVolumeRestorePhaseFailed),
time.Now()); err != nil {
s.logger.WithError(errors.WithStack(err)).Errorf("failed to patch podvolumerestore %q", pvr.GetName())