Uh oh!
There was an error while loading. Please reload this page.
kvm: let libvirt remove RBD snapshots on volume delete - #13763
Conversation
LibvirtStorageAdaptor#deletePhysicalDisk manually connected to Ceph via librados/librbd to unprotect and remove every snapshot of an RBD image before asking libvirt to delete the volume. libvirt's RBD storage backend has supported VIR_STORAGE_VOL_DELETE_WITH_SNAPSHOTS since 1.2.20, which does the same unprotect/remove internally. Pass that flag instead and drop the manual cleanup.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@## main #13763 +/- ##
=========================================
Coverage 19.65% 19.65% + Complexity 19792 19789 -3
=========================================
Files 6368 6368 Lines 574881 574843 -38 Branches 70351 70349 -2 =========================================
- Hits 112970 112963 -7 + Misses 449639 449607 -32 - Partials 12272 12273 +1
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:
|
weizhouapache
commented
Jul 31, 2026
nice ! |
wido
commented
Aug 1, 2026
Tnx! Fun is that I implemented this in Libvirt over 10y ago and totally forgot to fix it in CloudStack. Simple change to reduce the amount of code, better to have Libvirt do this. |
yeah. I have waited 4 years for the fix for #6180 😆 |
wido
commented
Aug 2, 2026
Here is the first one! Have a look at the code and review it. |
andrijapanicsb
commented
Aug 2, 2026
@blueorangutan package kvm |
blueorangutan
commented
Aug 2, 2026
@andrijapanicsb a [SL] Jenkins job has been kicked to build packages. It will be bundled with kvm SystemVM template(s). I'll keep you posted as I make progress. |
blueorangutan
commented
Aug 2, 2026
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✖️ debian ✔️ suse15. SL-JID 18734 |
weizhouapache
commented
Aug 2, 2026
@blueorangutan package |
blueorangutan
commented
Aug 2, 2026
@weizhouapache a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress. |
blueorangutan
commented
Aug 2, 2026
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 18735 |
DaanHoogland
commented
Aug 3, 2026
@wido, given your comments, should we add this in 4.20 LTS? |
There was a problem hiding this comment.
Pull request overview
This PR simplifies KVM RBD volume deletion by delegating RBD snapshot cleanup to libvirt, using the VIR_STORAGE_VOL_DELETE_WITH_SNAPSHOTS delete flag, and removing the prior manual Ceph (librados/librbd) snapshot unprotect/remove logic from deletePhysicalDisk.
Changes:
- Removed manual Ceph RBD snapshot unprotect/remove steps prior to volume deletion.
- Added the
VIR_STORAGE_VOL_DELETE_WITH_SNAPSHOTSflag (raw value) and conditionally applies it when deleting RBD-backed libvirt volumes. - Centralized the “delete with snapshots” behavior inside
deleteVol(...)for RBD pools.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
wido
commented
Aug 3, 2026
It is not going to fix anything, this is mainly code cleanup. I would not put that into an LTS personally |
DaanHoogland
commented
Aug 3, 2026
@blueorangutan test |
blueorangutan
commented
Aug 3, 2026
@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
andrijapanicsb
commented
Aug 3, 2026
@weizhouapache the DEB packaging seems randomly failing - I have run it on this specific PR to isolate a potential issue with my own PR ("prove" random failure on this PR) - and it seems it is random indeed? See #13656 (comment) Will kick off another round, really curious if it's going to fail. |
weizhouapache
commented
Aug 3, 2026
it failed at due to cc @NuxRo cloudstack build has dependency on your server 😄 |
blueorangutan
commented
Aug 3, 2026
[SF] Trillian Build Failed (tid-16672) |
weizhouapache
commented
Aug 3, 2026
@blueorangutan test |
blueorangutan
commented
Aug 3, 2026
@weizhouapache a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
andrijapanicsb
commented
Aug 3, 2026
hehehehe - btw, http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-kvm.qcow2.bz2 - works for me.... |
weizhouapache
commented
Aug 3, 2026
yes, the issue happened very rarely |
blueorangutan
commented
Aug 3, 2026
[SF] Trillian Build Failed (tid-16676) |
weizhouapache
commented
Aug 3, 2026
@blueorangutan test |
blueorangutan
commented
Aug 3, 2026
@weizhouapache a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
Is this behaviour consistent with general ACS behaviour - I think, for some funny reason - we do leave volume snapshots hanging around when an original volume is deleted - we should inclusively (storage-unrelated, NFS, CEPH, etc,) remove all related volume snapshots - if that is the decision - not just CEPH (but I absolutely support this garbage collection 😁 ) |
weizhouapache
commented
Aug 3, 2026
I think it is ceph-only: volume cannot be removed if volume snapshots exist. |
wido
commented
Aug 3, 2026
That is correct, Ceph refuses the removal if a snapshot exists. Again, this PR is just to clean-up code in CloudStack's Agent. Less code == better |
blueorangutan
commented
Aug 4, 2026
[SF] Trillian test result (tid-16678)
|
Description
LibvirtStorageAdaptor#deletePhysicalDisk manually connected to Ceph via librados/librbd to unprotect and remove every snapshot of an RBD image before asking libvirt to delete the volume. libvirt's RBD storage backend has supported VIR_STORAGE_VOL_DELETE_WITH_SNAPSHOTS since 1.2.20, which does the same unprotect/remove internally. Pass that flag instead and drop the manual cleanup.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale