Computing total backup size before uploading metadata.json file
@@ -934,6 +934,10 @@ func (a *ApplicationBackupController) backupResources(
backup.Status.Status = stork_api.ApplicationBackupStatusSuccessful
backup.Status.Reason = "Volumes and resources were backed up successfully"
+ // Only on success compute the total backup size
+ for _, vInfo := range backup.Status.Volumes {
+ backup.Status.Size += vInfo.Size
+ }
// Upload the metadata for the backup to the backup location
if err = a.uploadMetadata(backup); err != nil {
a.recorder.Event(backup,
@@ -945,10 +949,6 @@ func (a *ApplicationBackupController) backupResources(
}
backup.Status.LastUpdateTimestamp = metav1.Now()
- // Only on success compute the total backup size
- for _, vInfo := range backup.Status.Volumes {
- backup.Status.Size += vInfo.Size
- }
if err = a.client.Update(context.TODO(), backup); err != nil {
return err
