Fix in the calculation of a volume's physical size - #13286
Conversation
|
@blueorangutan package |
|
@winterhazel 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. |
There was a problem hiding this comment.
Pull request overview
This PR fixes KVM volume physical-size reporting by including the storage allocation of QCOW2 backing files in the reported KVMPhysicalDisk.size, aligning the “physical size” users see with actual storage usage when backing chains exist.
Changes:
- Added XML parsing to detect a volume’s backing file from libvirt volume XML.
- Updated KVM volume size calculation to recursively sum
allocationacross the backing chain. - Added a getter on
LibvirtStorageVolumeDef(though not directly used by the new sizing flow).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java | Recursively sums backing-file allocations and uses the result as the disk “physical size”. |
| plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtStorageVolumeXMLParser.java | Adds backing-store parsing from volume XML to resolve backing file names. |
| plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtStorageVolumeDef.java | Adds getVolSize() accessor for the volume size field. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## 4.22 #13286 +/- ##
============================================
- Coverage 17.94% 17.93% -0.01%
Complexity 16147 16147
============================================
Files 5928 5928
Lines 535174 535224 +50
Branches 65494 65500 +6
============================================
Hits 96019 96019
- Misses 428226 428276 +50
Partials 10929 10929
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 18087 |
|
@Tonitzpp can you check and address the copilot comments if relavant. thanks. |
|
@GeanJair, could you take a look at @JoaoJandre's suggestion, please? (see #13286 (comment)) |
|
@blueorangutan package |
|
@abh1sar 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. |
|
Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 19204 |
|
@blueorangutan package |
|
@JoaoJandre 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. |
|
Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 19206 |
|
@blueorangutan package |
|
@abh1sar 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. |
|
Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 19218 |
|
Looks like there is a compilation error @Tonitzpp |
841513d to
77fbaba
Compare
Description
Currently, when using the KVM hypervisor, the calculation of a volume's physical size ignores the backing files (if they exist) as part of the volume's physical size in storage, which can cause confusion for users. This behavior has been changed in this PR so that the backing files are now taken into account for the volume's physical size.
Types of changes
Feature/Enhancement Scale or Bug Severity
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
To perform the tests, I created a new VM with a backing file, and after that I took a few backups of this VM. Then, when checking the volume of this VM, it was observed that the physical size is proportional to the physical size in the storage.