Skip to content

NAS backup: keep the Failed row when the agent reports a failed backup - #14487

Open
abh1sar wants to merge 1 commit into
apache:mainfrom
shapeblue:nas-backup-keep-failed-row
Open

abh1sar wants to merge 1 commit into
apache:mainfrom
shapeblue:nas-backup-keep-failed-row

Conversation

@abh1sar

@abh1sar abh1sar commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

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

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

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.
Copilot AI balanced review requested due to automatic review settings October 23, 2026 04:15
@codecov

codecov Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 20.44%. Comparing base (c76c01e) to head (65c0446).
⚠️ Report is 1 commits behind head on main.

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     
Flag Coverage Δ
uitests 3.70% <ø> (ø)
unittests 21.75% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.takeBackup to update the backup row to Failed and return it, instead of deleting it and returning null.
  • Update the unit test to assert a failed backup object is returned and that remove is 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

Comment on lines 671 to +673
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));

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants