Skip to content

Commit 6bedc27

Browse files
committed
Set the backup status as 'Error' in case of any error from backend.
1 parent 440fcc0 commit 6bedc27

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

plugins/backup/nas/src/main/java/org/apache/cloudstack/backup/NASBackupProvider.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,12 @@ public Pair<Boolean, Backup> takeBackup(final VirtualMachine vm) {
171171
try {
172172
answer = (BackupAnswer) agentManager.send(host.getId(), command);
173173
} catch (AgentUnavailableException e) {
174+
backupVO.setStatus(Backup.Status.Error);
175+
backupDao.update(backupVO.getId(), backupVO);
174176
throw new CloudRuntimeException("Unable to contact backend control plane to initiate backup");
175177
} catch (OperationTimedoutException e) {
178+
backupVO.setStatus(Backup.Status.Error);
179+
backupDao.update(backupVO.getId(), backupVO);
176180
throw new CloudRuntimeException("Operation to initiate backup timed out, please try again");
177181
}
178182

@@ -255,7 +259,7 @@ private boolean restoreVMBackup(VirtualMachine vm, Backup backup) {
255259
} catch (AgentUnavailableException e) {
256260
throw new CloudRuntimeException("Unable to contact backend control plane to initiate backup");
257261
} catch (OperationTimedoutException e) {
258-
throw new CloudRuntimeException("Operation to initiate backup timed out, please try again");
262+
throw new CloudRuntimeException("Operation to restore backup timed out, please try again");
259263
}
260264
return answer.getResult();
261265
}
@@ -322,7 +326,7 @@ public Pair<Boolean, String> restoreBackedUpVolume(Backup backup, Backup.VolumeI
322326
} catch (AgentUnavailableException e) {
323327
throw new CloudRuntimeException("Unable to contact backend control plane to initiate backup");
324328
} catch (OperationTimedoutException e) {
325-
throw new CloudRuntimeException("Operation to initiate backup timed out, please try again");
329+
throw new CloudRuntimeException("Operation to restore backed up volume timed out, please try again");
326330
}
327331

328332
if (answer.getResult()) {
@@ -374,7 +378,7 @@ public boolean deleteBackup(Backup backup, boolean forced) {
374378
} catch (AgentUnavailableException e) {
375379
throw new CloudRuntimeException("Unable to contact backend control plane to initiate backup");
376380
} catch (OperationTimedoutException e) {
377-
throw new CloudRuntimeException("Operation to initiate backup timed out, please try again");
381+
throw new CloudRuntimeException("Operation to delete backup timed out, please try again");
378382
}
379383

380384
if (answer != null && answer.getResult()) {

0 commit comments

Comments
 (0)