You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by "abh1sar (via GitHub)" <gi...@apache.org> on 2026/10/23 04:16:01 UTC

[PR] NAS backup: keep the Failed row when the agent reports a failed backup [cloudstack]

abh1sar opened a new pull request, #14487:
URL: https://github.com/apache/cloudstack/pull/14487

   ### 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.
   
   <!--- Describe your changes in DETAIL - And how has behaviour functionally changed. -->
   
   <!-- For new features, provide link to FS, dev ML discussion etc. -->
   <!-- In case of bug fix, the expected and actual behaviours, steps to reproduce. -->
   
   <!-- When "Fixes: #<id>" is specified, the issue/PR will automatically be closed when this PR gets merged -->
   <!-- For addressing multiple issues/PRs, use multiple "Fixes: #<id>" -->
   <!-- Fixes: # -->
   
   <!--- ******************************************************************************* -->
   <!--- NOTE: AUTOMATION USES THE DESCRIPTIONS TO SET LABELS AND PRODUCE DOCUMENTATION. -->
   <!--- PLEASE PUT AN 'X' in only **ONE** box -->
   <!--- ******************************************************************************* -->
   
   ### Types of changes
   
   - [ ] Breaking change (fix or feature that would cause existing functionality to change)
   - [ ] New feature (non-breaking change which adds functionality)
   - [x] 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
   - [x] Minor
   - [ ] Trivial
   
   ### Screenshots (if appropriate):
   
   ### How Has This Been Tested?
   
   <!-- Please describe in detail how you tested your changes. -->
   <!-- Include details of your testing environment, and the tests you ran to -->
   
   #### How did you try to break this feature and the system with this change?
   
   <!-- see how your change affects other areas of the code, etc. -->
   
   <!-- Please read the [CONTRIBUTING](https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md) document -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] NAS backup: keep the Failed row when the agent reports a failed backup [cloudstack]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #14487:
URL: https://github.com/apache/cloudstack/pull/14487#discussion_r4356109722


##########
plugins/backup/nas/src/main/java/org/apache/cloudstack/backup/NASBackupProvider.java:
##########
@@ -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);

Review Comment:
   `backupDao.update(...)` commonly returns a boolean in CloudStack DAOs; if the update fails, the method will still return a `Failed` backup object even though the persisted row may not reflect that status. Consider checking the return value and either throwing/returning an error state (or at least logging) so callers don’t assume the DB row was successfully updated.



##########
plugins/backup/nas/src/test/java/org/apache/cloudstack/backup/NASBackupProviderTest.java:
##########
@@ -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));

Review Comment:
   The test verifies `update(...)` is called, but it doesn’t assert that the `BackupVO` passed to `update` actually has `Status.Failed`. To prevent regressions where the returned object is mutated but the persisted object isn’t, capture the `BackupVO` argument (e.g., with an `ArgumentCaptor`) and assert its status is `Failed` (and optionally that the ID matches the expected backup row).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] NAS backup: keep the Failed row when the agent reports a failed backup [cloudstack]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #14487:
URL: https://github.com/apache/cloudstack/pull/14487#issuecomment-6357363052

   ## [Codecov](https://app.codecov.io/gh/apache/cloudstack/pull/14487?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 3.70%. Comparing base ([`c76c01e`](https://app.codecov.io/gh/apache/cloudstack/commit/c76c01e21a1d98fbdcb5da051d7336838873eeb0?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`65c0446`](https://app.codecov.io/gh/apache/cloudstack/commit/65c04464571fe437ee45f8f4cfb68995574f37b8?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 1 commits behind head on main.
   > :exclamation:  There is a different number of reports uploaded between BASE (c76c01e) and HEAD (65c0446). Click for more details.
   > 
   > <details><summary>HEAD has 1 upload less than BASE</summary>
   >
   >| Flag | BASE (c76c01e) | HEAD (65c0446) |
   >|------|------|------|
   >|unittests|1|0|
   ></details>
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@              Coverage Diff              @@
   ##               main   #14487       +/-   ##
   =============================================
   - Coverage     20.45%    3.70%   -16.75%     
   =============================================
     Files          6487      493     -5994     
     Lines        589329    42558   -546771     
     Branches      72246     8063    -64183     
   =============================================
   - Hits         120554     1578   -118976     
   + Misses       455642    40751   -414891     
   + Partials      13133      229    -12904     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/cloudstack/pull/14487/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [uitests](https://app.codecov.io/gh/apache/cloudstack/pull/14487/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `3.70% <ø> (ø)` | |
   | [unittests](https://app.codecov.io/gh/apache/cloudstack/pull/14487/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/cloudstack/pull/14487?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org