Corrected the error handling, while calling CloudBackupCreate api.
@@ -2847,16 +2847,20 @@ func (p *portworx) StartBackup(backup *storkapi.ApplicationBackup,
err = wait.ExponentialBackoff(cloudBackupCreateBackoff, func() (bool, error) {
_, cloudBackupCreateErr = volDriver.CloudBackupCreate(request)
if cloudBackupCreateErr != nil {
- if _, ok := err.(*ost_errors.ErrExists); !ok {
+ if _, ok := cloudBackupCreateErr.(*ost_errors.ErrExists); !ok {
+ logrus.Warnf("failed to start backup for %v (%v/%v): %v, retrying again",
+ volume, pvc.Namespace, pvc.Name, cloudBackupCreateErr)
return false, nil
}
}
return true, nil
})
if err != nil || cloudBackupCreateErr != nil {
+ if _, ok := cloudBackupCreateErr.(*ost_errors.ErrExists); !ok {
return nil, fmt.Errorf("failed to start backup for %v (%v/%v): %v",
volume, pvc.Namespace, pvc.Name, cloudBackupCreateErr)
}
+ }
}
return volumeInfos, nil
