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

   ### Description
   
   
       KVM: create an encrypted RBD volume with room for its LUKS2 header
       
       librbd keeps the LUKS2 header in the RBD image, in front of the data, so 
an
       encrypted RBD volume created with the size of its volume showed the 
Instance
       16 MiB less, while a qemu LUKS volume on NFS, SharedMountPoint or local
       storage shows the Instance the size of its volume. Create the image of an
       encrypted RBD volume with room for the header instead, so that the 
Instance
       sees the size of the volume on every pool type, and the size of the 
volume
       in the database is what the Instance sees.
       
       The size of the header is the larger of 16 MiB and the object size of the
       image (measured: 16 MiB with objects of 1 to 16 MiB, 32 MiB with objects 
of
       32 MiB), so the image is grown when its objects are larger.
       
       - LibvirtStorageAdaptor.createPhysicalDisk() creates an encrypted RBD
         image with the header on top of the size it is given.
       - LibvirtResizeVolumeCommandWrapper answers with the size the Instance
         sees for an encrypted RBD volume, so the database no longer gets the
         size of the image (the size of the volume + 16 MiB) after a resize.
       - The CoW clone of a template for an encrypted ROOT volume is made from a
         snapshot of the template grown by the header, and the template is 
shrunk
         back right after the snapshot. The template used to stay 16 MiB 
larger, so
         the next unencrypted clone of it, if its base snapshot did not exist 
yet,
         was 16 MiB larger than its template. The clone is grown to the 
requested
         size from its own size, and the full copy of a template makes room for 
a
         header larger than 16 MiB as well.
       
       Tests:
       - unit test for the size of the header
       - the TestVolumeEncryption smoke tests already expect the Instance to see
         the size of the volume
   
   
   <!--- 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
   - [ ] 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: [email protected]

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

Reply via email to