@@ -660,7 +660,6 @@ func (a *ApplicationBackupController) backupVolumes(backup *stork_api.Applicatio
660
660
namespacedName .Namespace = backup .Namespace
661
661
namespacedName .Name = backup .Name
662
662
if len (backup .Status .Volumes ) != pvcCount {
663
-
664
663
for driverName , pvcs := range pvcMappings {
665
664
var driver volume.Driver
666
665
driver , err = volume .Get (driverName )
@@ -726,44 +725,31 @@ func (a *ApplicationBackupController) backupVolumes(backup *stork_api.Applicatio
726
725
if err != nil {
727
726
return err
728
727
}
729
- // In case Portworx if the snapshot ID is populated for every volume then the snapshot
730
- // process is considered to be completed successfully.
731
- // This ensures we don't execute the post-exec before all volume's snapshot is completed
732
- if driverName == volume .PortworxDriverName {
733
- startTime := time .Now ()
734
- for {
735
- // In case below logic genuinely takes long time for many volumes
736
- // the CR timestamp need to be updated. This prevents backup timeout error.
737
- elapsedTime := time .Since (startTime )
738
- if elapsedTime > utils .TimeoutUpdateBackupCrTimestamp {
739
- backup , err = a .updateBackupCRInVolumeStage (
740
- namespacedName ,
741
- stork_api .ApplicationBackupStatusInProgress ,
742
- backup .Status .Stage ,
743
- "Volume backups are in progress" ,
744
- volumeInfos ,
745
- )
746
- if err != nil {
747
- return err
748
- }
749
- startTime = time .Now ()
750
- }
751
- // Get fresh stock of the status for all volumes.
752
- snapshotNotCompleted := false
753
- volumeInfos , err = driver .GetBackupStatus (backup )
754
- if err != nil {
755
- log .ApplicationBackupLog (backup ).Errorf ("error getting backup status for driver %v: %v" , driverName , err )
756
- return fmt .Errorf ("error getting backup status for driver %v: %v" , driverName , err )
757
- }
758
- for _ , volInfo := range volumeInfos {
759
- if volInfo .BackupID == "" {
760
- log .ApplicationBackupLog (backup ).Tracef ("Snapshot of volume %v is not done yet, need to loop till snapshot is done..." , volInfo .PersistentVolumeClaim )
761
- snapshotNotCompleted = true
762
- }
763
- }
764
- if ! snapshotNotCompleted {
765
- break
766
- }
728
+ }
729
+ }
730
+
731
+ // In case Portworx if the snapshot ID is populated for every volume then the snapshot
732
+ // process is considered to be completed successfully.
733
+ // This ensures we don't execute the post-exec before all volume's snapshot is completed
734
+ for driverName := range pvcMappings {
735
+ var driver volume.Driver
736
+ driver , err = volume .Get (driverName )
737
+ if err != nil {
738
+ return err
739
+ }
740
+ if driverName == volume .PortworxDriverName {
741
+ volumeInfos , err := driver .GetBackupStatus (backup )
742
+ if err != nil {
743
+ return fmt .Errorf ("error getting backup status: %v" , err )
744
+ }
745
+ for _ , volInfo := range volumeInfos {
746
+ if volInfo .BackupID == "" {
747
+ log .ApplicationBackupLog (backup ).Infof ("Snapshot of volume [%v] hasn't completed yet, retry checking status" , volInfo .PersistentVolumeClaim )
748
+ // Some portworx volume snapshot is not completed yet
749
+ // hence we will retry checking the status in the next reconciler iteration
750
+ // *stork_api.ApplicationBackupVolumeInfo.Status is not being checked here
751
+ // since backpID confirms if the snapshot is done or not already
752
+ return nil
767
753
}
768
754
}
769
755
}
0 commit comments