bhouse-nexthop opened a new pull request, #14901:
URL: https://github.com/apache/cloudstack/pull/14901

   ### Description
   
   Fixes #14900
   
   Volume snapshots and snapshot policies are refused for CKS node volumes 
built from the SYSTEM-type system VM template (the CKS default), with "Creating 
snapshot against System VM volumes is not supported". Shared FileSystem VM root 
volumes are refused the same way.
   
   The guard in `VolumeApiServiceImpl.isOperationSupported` and 
`SnapshotManagerImpl.createPolicy` was:
   
   ```java
   SYSTEM && (userVm == null || !CKS_NODE.equals(type) || 
!SHAREDFSVM.equals(type))
   ```
   
   No VM is both types, so it was always true. #9208 added the `SHAREDFSVM` 
term to exempt Shared FileSystem VMs as well, as it did in the deploy check in 
`UserVmManagerImpl` (`!CKS_NODE.equals(vmType) && !SHAREDFSVM.equals(vmType)`), 
but with `||` it removed the CKS exemption instead. This changes `||` to `&&` 
in both places.
   
   | Volume from a SYSTEM template, attached to | Before | After |
   |---|---|---|
   | CKS node | refused | allowed |
   | Shared FileSystem VM | refused | allowed |
   | other user VM | refused | refused |
   | system VM, router, or detached | refused | refused |
   
   ### 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
   
   #### Bug Severity
   
   - [ ] BLOCKER
   - [ ] Critical
   - [ ] Major
   - [x] Minor
   - [ ] Trivial
   
   ### Screenshots (if appropriate):
   
   ### How Has This Been Tested?
   
   - Unit tests for both guards: CKS node and Shared FileSystem VM allowed, 
other user VM and no VM refused, USER template allowed. 
`VolumeApiServiceImplTest` and `SnapshotManagerImplTest`: 192 passed. Without 
the fix the 4 "allowed" tests fail.
   - Not tested yet: a snapshot of a live CKS node volume on a lab.
   
   #### How did you try to break this feature and the system with this change?
   
   - Volumes of system VMs and routers still have no user VM row, so they are 
still refused.
   - A volume created from a snapshot of a CKS node root volume keeps the 
SYSTEM template id, so its own snapshots are refused unless it is attached to a 
CKS node. That is unchanged and not handled here.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to