Repository navigation
Conversation
apache#13180 made takeBackup keep the backup row in Failed state instead of deleting it. The forward merge of 4.22 after apache#14305 resolved the failed-answer branch to the 4.22 version, which deletes the row again. Restore the update and return the row to the caller as the Error branch does, so the schedule, name and resource counts are recorded on it.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #14487 +/- ##
============================================
- Coverage 20.45% 20.44% -0.01%
+ Complexity 21417 21411 -6
============================================
Files 6487 6487
Lines 589329 589329
Branches 72246 72246
============================================
- Hits 120554 120506 -48
- Misses 455642 455695 +53
+ Partials 13133 13128 -5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
2 open issues
What changed in this PR
Restores NAS backup behavior so that when the agent reports a failed backup (without needing cleanup), the DB row is retained in Failed state and returned to the caller, preserving metadata like schedule/name/resource counts.
Changes:
- Update
NASBackupProvider.takeBackuptoupdatethe backup row toFailedand return it, instead of deleting it and returningnull. - Update the unit test to assert a failed backup object is returned and that
removeis not called.
| File | Description |
|---|---|
| plugins/backup/nas/src/main/java/org/apache/cloudstack/backup/NASBackupProvider.java | Persist failed status via DAO update and return the failed backup row to the caller. |
| plugins/backup/nas/src/test/java/org/apache/cloudstack/backup/NASBackupProviderTest.java | Adjust test expectations to ensure failed backups are retained and updated rather than removed. |
Review effort: Lite
| backupVO.setStatus(Backup.Status.Failed); | ||
| backupDao.remove(backupVO.getId()); | ||
| return new Pair<>(false, null); | ||
| backupDao.update(backupVO.getId(), backupVO); | ||
| return new Pair<>(false, backupVO); |
| 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)); |

Description
#13180 made takeBackup keep the backup row in Failed state instead of deleting it.
The forward merge of 4.22 after #14305 resolved the failed-answer branch to the 4.22 version, which deletes the row again. Restore the update and return the row to the caller as the Error branch does, so the schedule, name and resource counts are recorded on it.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?