Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -669,8 +669,8 @@ public Pair<Boolean, Backup> takeBackup(final VirtualMachine vm, Boolean quiesce
return new Pair<>(false, backupVO);
}
backupVO.setStatus(Backup.Status.Failed);
backupDao.remove(backupVO.getId());
return new Pair<>(false, null);
backupDao.update(backupVO.getId(), backupVO);
return new Pair<>(false, backupVO);
Comment on lines 671 to +673
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ public void takeBackupFailureNeedingCleanupReturnsErrorBackup() throws AgentUnav
}

@Test
public void takeBackupFailureWithoutCleanupRemovesBackup() throws AgentUnavailableException, OperationTimedoutException {
public void takeBackupFailureWithoutCleanupKeepsFailedBackup() throws AgentUnavailableException, OperationTimedoutException {
VMInstanceVO vm = mockRunningVmForBackup(1L, 2L, 3L, 4L, 5L, 6L);

BackupAnswer answer = mock(BackupAnswer.class);
Expand All @@ -324,8 +324,10 @@ public void takeBackupFailureWithoutCleanupRemovesBackup() throws AgentUnavailab
Pair<Boolean, Backup> result = nasBackupProvider.takeBackup(vm, false, false);

Assert.assertFalse(result.first());
Assert.assertNull(result.second());
Mockito.verify(backupDao).remove(Mockito.anyLong());
Assert.assertNotNull(result.second());
Assert.assertEquals(Backup.Status.Failed, result.second().getStatus());
Mockito.verify(backupDao).update(Mockito.anyLong(), Mockito.any(BackupVO.class));
Mockito.verify(backupDao, Mockito.never()).remove(Mockito.anyLong());
Mockito.verifyNoInteractions(alertManager);
}

Expand Down
Loading