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

[PR] Don't allow assign VM to backup offering for VM with encrypted volumes [cloudstack]

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

   ### Description
   
   This PR does't allow assign VM to backup offering for VM with encrypted volumes.
   
   Fixes #13197 
   
   <!--- 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] Don't allow assign VM to backup offering for VM with encrypted volumes [cloudstack]

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


##########
server/src/main/java/org/apache/cloudstack/backup/BackupManagerImpl.java:
##########
@@ -441,6 +441,13 @@ public boolean assignVMToBackupOffering(Long vmId, Long offeringId) {
             throw new CloudRuntimeException("VM is not in running or stopped state");
         }
 
+        List<VolumeVO> volumes = volumeDao.findByInstance(vmId);
+        for (VolumeVO volume : volumes) {
+            if (volume != null && volume.getPassphraseId() != null) {
+                throw new CloudRuntimeException("VM has encrypted volumes, backup offering assignment is not allowed");
+            }
+        }
+

Review Comment:
   Move this to NasBackupProvider.java in backupProvider.assignVMToBackupOffering.
   
   We want to disable backup for encrypted volume for just nas backup provider.



-- 
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] Don't allow assign VM to backup offering for VM with encrypted volumes [cloudstack]

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


##########
server/src/test/java/org/apache/cloudstack/backup/BackupManagerTest.java:
##########
@@ -1225,11 +1233,32 @@ public void testAssignVMToBackupOffering() {
 
             assertTrue(result);
             verify(vmInstanceDao, times(1)).findById(vmId);
+            verify(volumeDao, times(2)).findByInstance(vmId);
             verify(backupOfferingDao, times(1)).findById(offeringId);
             verify(backupManager, times(1)).getBackupProvider("testbackupprovider");
         }
     }
 
+    @Test (expected = CloudRuntimeException.class)
+    public void testAssignVMToBackupOfferingForVMWithEncryptedVolumes() {
+        Long vmId = 1L;
+        Long offeringId = 2L;
+
+        VMInstanceVO vm = mock(VMInstanceVO.class);
+        overrideBackupFrameworkConfigValue();
+
+        when(vmInstanceDao.findById(vmId)).thenReturn(vm);
+        when(vm.getState()).thenReturn(VirtualMachine.State.Running);
+        VolumeVO volume = mock(VolumeVO.class);
+        when(volumeDao.findByInstance(vmId)).thenReturn(List.of(volume));
+        when(volume.getPassphraseId()).thenReturn(42L);
+
+        try (MockedStatic<UsageEventUtils> ignored2 = Mockito.mockStatic(UsageEventUtils.class)) {
+            backupManager.assignVMToBackupOffering(vmId, offeringId);

Review Comment:
   Nit: `assignVMToBackupOffering` is expected to throw here, so the `verify(vmInstanceDao, times(1)).findById(vmId)` call right after it is unreachable, dead code.



-- 
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] Don't allow assign VM to backup offering for VM with encrypted volumes [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #13229:
URL: https://github.com/apache/cloudstack/pull/13229#issuecomment-4533104493

   Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 18012


-- 
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] Don't allow assign VM to backup offering for VM with encrypted volumes [cloudstack]

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


##########
server/src/main/java/org/apache/cloudstack/backup/BackupManagerImpl.java:
##########
@@ -441,6 +441,13 @@ public boolean assignVMToBackupOffering(Long vmId, Long offeringId) {
             throw new CloudRuntimeException("VM is not in running or stopped state");
         }
 
+        List<VolumeVO> volumes = volumeDao.findByInstance(vmId);
+        for (VolumeVO volume : volumes) {
+            if (volume != null && volume.getPassphraseId() != null) {
+                throw new CloudRuntimeException("VM has encrypted volumes, backup offering assignment is not allowed");
+            }
+        }
+

Review Comment:
   Move this to NasBackupProvider.java in backupProvider.assignVMToBackupOffering.
   
   We want to disable backup for encrypted volume for just nas backup provider.



-- 
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] Don't allow assign VM to backup offering for VM with encrypted volumes [cloudstack]

Posted by "sureshanaparti (via GitHub)" <gi...@apache.org>.
sureshanaparti commented on PR #13229:
URL: https://github.com/apache/cloudstack/pull/13229#issuecomment-4532704160

   @blueorangutan package


-- 
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] Don't allow assign VM to backup offering for VM with encrypted volumes [cloudstack]

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


##########
server/src/main/java/org/apache/cloudstack/backup/BackupManagerImpl.java:
##########
@@ -441,6 +441,13 @@ public boolean assignVMToBackupOffering(Long vmId, Long offeringId) {
             throw new CloudRuntimeException("VM is not in running or stopped state");
         }
 
+        List<VolumeVO> volumes = volumeDao.findByInstance(vmId);
+        for (VolumeVO volume : volumes) {
+            if (volume != null && volume.getPassphraseId() != null) {
+                throw new CloudRuntimeException("VM has encrypted volumes, backup offering assignment is not allowed");
+            }
+        }
+

Review Comment:
   @sureshanaparti ^



-- 
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] Don't allow assign VM to backup offering for VM with encrypted volumes [cloudstack]

Posted by "kiranchavala (via GitHub)" <gi...@apache.org>.
kiranchavala commented on PR #13229:
URL: https://github.com/apache/cloudstack/pull/13229#issuecomment-4598779922

   @blueorangutan test


-- 
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] Don't allow assign VM to backup offering for VM with encrypted volumes [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #13229:
URL: https://github.com/apache/cloudstack/pull/13229#issuecomment-4543800982

   @DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests


-- 
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] Don't allow assign VM to backup offering for VM with encrypted volumes [cloudstack]

Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on PR #13229:
URL: https://github.com/apache/cloudstack/pull/13229#issuecomment-4543799097

   @blueorangutan test


-- 
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] Don't allow assign VM to backup offering for VM with encrypted volumes [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #13229:
URL: https://github.com/apache/cloudstack/pull/13229#issuecomment-4543999527

   <b>[SF] Trillian Build Failed (tid-16177)<b/>


-- 
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] Don't allow assign VM to backup offering for VM with encrypted volumes [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #13229:
URL: https://github.com/apache/cloudstack/pull/13229#issuecomment-4606321127

   <b>[SF] Trillian test result (tid-16238)</b>
   Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
   Total time taken: 50447 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr13229-t16238-kvm-ol8.zip
   Smoke tests completed. 149 look OK, 0 have errors, 0 did not run
   Only failed and skipped tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   


-- 
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] Don't allow assign VM to backup offering for VM with encrypted volumes [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #13229:
URL: https://github.com/apache/cloudstack/pull/13229#issuecomment-4598785015

   @kiranchavala a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests


-- 
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] Don't allow assign VM to backup offering for VM with encrypted volumes [cloudstack]

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


##########
server/src/main/java/org/apache/cloudstack/backup/BackupManagerImpl.java:
##########
@@ -441,6 +441,13 @@ public boolean assignVMToBackupOffering(Long vmId, Long offeringId) {
             throw new CloudRuntimeException("VM is not in running or stopped state");
         }
 
+        List<VolumeVO> volumes = volumeDao.findByInstance(vmId);
+        for (VolumeVO volume : volumes) {
+            if (volume != null && volume.getPassphraseId() != null) {
+                throw new CloudRuntimeException("VM has encrypted volumes, backup offering assignment is not allowed");
+            }
+        }
+

Review Comment:
   Move this to NasBackupProvider.java in backupProvider.assignVMToBackupOffering.
   
   We want to disable backup for encrypted volume for just nas backup provider.



##########
server/src/main/java/org/apache/cloudstack/backup/BackupManagerImpl.java:
##########
@@ -441,6 +441,13 @@ public boolean assignVMToBackupOffering(Long vmId, Long offeringId) {
             throw new CloudRuntimeException("VM is not in running or stopped state");
         }
 
+        List<VolumeVO> volumes = volumeDao.findByInstance(vmId);
+        for (VolumeVO volume : volumes) {
+            if (volume != null && volume.getPassphraseId() != null) {
+                throw new CloudRuntimeException("VM has encrypted volumes, backup offering assignment is not allowed");
+            }
+        }
+

Review Comment:
   @sureshanaparti ^



-- 
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] Don't allow assign VM to backup offering for VM with encrypted volumes [cloudstack]

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


##########
server/src/main/java/org/apache/cloudstack/backup/BackupManagerImpl.java:
##########
@@ -441,6 +441,13 @@ public boolean assignVMToBackupOffering(Long vmId, Long offeringId) {
             throw new CloudRuntimeException("VM is not in running or stopped state");
         }
 
+        List<VolumeVO> volumes = volumeDao.findByInstance(vmId);
+        for (VolumeVO volume : volumes) {
+            if (volume != null && volume.getPassphraseId() != null) {
+                throw new CloudRuntimeException("VM has encrypted volumes, backup offering assignment is not allowed");
+            }
+        }
+

Review Comment:
   @sureshanaparti ^



-- 
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] Don't allow assign VM to backup offering for VM with encrypted volumes [cloudstack]

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

   ## [Codecov](https://app.codecov.io/gh/apache/cloudstack/pull/13229?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.69%. Comparing base ([`21b2025`](https://app.codecov.io/gh/apache/cloudstack/commit/21b2025c5055d4580e828f708d406510853f0060?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`3e0894d`](https://app.codecov.io/gh/apache/cloudstack/commit/3e0894d07b41bf048eb20a441da82f56897b9b91?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   > :exclamation:  There is a different number of reports uploaded between BASE (21b2025) and HEAD (3e0894d). Click for more details.
   > 
   > <details><summary>HEAD has 1 upload less than BASE</summary>
   >
   >| Flag | BASE (21b2025) | HEAD (3e0894d) |
   >|------|------|------|
   >|unittests|1|0|
   ></details>
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@              Coverage Diff              @@
   ##               4.22   #13229       +/-   ##
   =============================================
   - Coverage     17.67%    3.69%   -13.98%     
   =============================================
     Files          5922      448     -5474     
     Lines        533165    38105   -495060     
     Branches      65208     7059    -58149     
   =============================================
   - Hits          94242     1409    -92833     
   + Misses       428276    36509   -391767     
   + Partials      10647      187    -10460     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/cloudstack/pull/13229/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/13229/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `3.69% <ø> (ø)` | |
   | [unittests](https://app.codecov.io/gh/apache/cloudstack/pull/13229/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 Sentry](https://app.codecov.io/gh/apache/cloudstack/pull/13229?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


Re: [PR] Don't allow assign VM to backup offering for VM with encrypted volumes [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #13229:
URL: https://github.com/apache/cloudstack/pull/13229#issuecomment-4532713039

   @sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with  KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.


-- 
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