fix issue 6490 (#6491)

Signed-off-by: Lyndon-Li <lyonghui@vmware.com>
This commit is contained in:
lyndon
2023-07-15 02:05:51 +08:00
committed by GitHub
parent ddc50affa9
commit b5bd55fc56
3 changed files with 9 additions and 6 deletions

View File

@@ -0,0 +1 @@
Fix issue 6490, If a backup/restore has multiple async operations and one operation fails while others are still in-progress, when all the operations finish, the backup/restore will be set as Completed falsely

View File

@@ -185,14 +185,15 @@ func (c *backupOperationsReconciler) Reconcile(ctx context.Context, req ctrl.Req
operations.ChangesSinceUpdate = true
}
if len(operations.ErrsSinceUpdate) > 0 {
backup.Status.Phase = velerov1api.BackupPhaseWaitingForPluginOperationsPartiallyFailed
}
// if stillInProgress is false, backup moves to finalize phase and needs update
// if operations.ErrsSinceUpdate is not empty, then backup phase needs to change to
// BackupPhaseWaitingForPluginOperationsPartiallyFailed and needs update
// If the only changes are incremental progress, then no write is necessary, progress can remain in memory
if !stillInProgress {
if len(operations.ErrsSinceUpdate) > 0 {
backup.Status.Phase = velerov1api.BackupPhaseWaitingForPluginOperationsPartiallyFailed
}
if backup.Status.Phase == velerov1api.BackupPhaseWaitingForPluginOperations {
log.Infof("Marking backup %s Finalizing", backup.Name)
backup.Status.Phase = velerov1api.BackupPhaseFinalizing

View File

@@ -177,14 +177,15 @@ func (r *restoreOperationsReconciler) Reconcile(ctx context.Context, req ctrl.Re
operations.ChangesSinceUpdate = true
}
if len(operations.ErrsSinceUpdate) > 0 {
restore.Status.Phase = velerov1api.RestorePhaseWaitingForPluginOperationsPartiallyFailed
}
// if stillInProgress is false, restore moves to terminal phase and needs update
// if operations.ErrsSinceUpdate is not empty, then restore phase needs to change to
// RestorePhaseWaitingForPluginOperationsPartiallyFailed and needs update
// If the only changes are incremental progress, then no write is necessary, progress can remain in memory
if !stillInProgress {
if len(operations.ErrsSinceUpdate) > 0 {
restore.Status.Phase = velerov1api.RestorePhaseWaitingForPluginOperationsPartiallyFailed
}
if restore.Status.Phase == velerov1api.RestorePhaseWaitingForPluginOperations {
log.Infof("Marking restore %s completed", restore.Name)
restore.Status.Phase = velerov1api.RestorePhaseCompleted