You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR adds VM snapshot support for the CLVM_NG storage pool type on KVM. Disk-only snapshots work on running and stopped VMs, with UEFI support. Disk+memory snapshots are included as an experimental feature, off by default.
Approach
CLVM_NG volumes are qcow2 images on LVs in a shared VG. A VM snapshot uses external qcow2 overlays, one LV each.
Taking a snapshot freezes the volume's current LV as a layer and creates a new delta LV on top, with the layer as its backing file.
The agent pre-creates the delta LVs (lvcreate plus qemu-img create -b) before the guest is touched, because libvirt can't create block-backed overlays itself. It then calls snapshotCreateXML with block-typed disks and DISK_ONLY | ATOMIC | NO_METADATA | REUSE_EXT.
Revert creates a new overlay on the snapshot layer. Delete merges the delta into its parent: blockcommit --active --pivot for a running VM, qemu-img commit for a stopped one.
KvmFileBasedStorageVmSnapshotStrategy handles CLVM_NG. DefaultVMSnapshotStrategy now refuses any VM with a CLVM_NG volume, so no internal snapshot is ever taken on an LV.
The storage-specific steps (delta create/delete, sidecars, memory LV) are default methods on StorageAdaptor, implemented by ClvmStorageAdaptor. File-based pools keep their existing behaviour.
UEFI
The guest NVRAM is saved into a small sidecar LV (vmsnapshot-nvram-). Revert restores it, and delete or expunge removes it.
Locking and migration
Layers are exclusive after a snapshot and shared while the VM runs.
Live migration walks the backing chain (ClvmBackingChain) and activates every layer shared on both hosts, then makes them exclusive on the destination.
Stop followed by start on another host releases the old host's layers through ClvmLockTransferCommand DEACTIVATE.
Activating a layer retries for up to 180 s while another host holds its lock.
Merging first makes the parent layer exclusive.
Experimental: disk+memory
The memory goes into its own LV (vmsnapshot-memory-), sized at the VM's maximum memory plus 128 MiB. It is written by libvirt's external memory snapshot.
Revert needs a running VM. It creates new overlays, restores the NVRAM for UEFI, and runs virsh restore with the disk paths swapped.
It is gated by the zone setting kvm.clvmng.vmsnapshot.memory.enabled (default false).
External snapshots were chosen over internal ones. Internal snapshots put RAM in the qcow2, so later writes grow the file on a fixed-size LV and can hit ENOSPC. In a benchmark they were also about 5x slower on first overwrite.
Types of changes
Breaking change (fix or feature that would cause existing functionality to change)
New feature (non-breaking change which adds functionality)
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?
How did you try to break this feature and the system with this change?
❌ Patch coverage is 43.58974% with 308 lines in your changes missing coverage. Please review.
✅ Project coverage is 21.08%. Comparing base (85ca17a) to head (1e23cb2). ⚠️ Report is 2 commits behind head on main.
@Pearl1594 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds VM snapshot support for the CLVM_NG storage pool type on KVM. Disk-only snapshots work on running and stopped VMs, with UEFI support. Disk+memory snapshots are included as an experimental feature, off by default.
Approach
CLVM_NG volumes are qcow2 images on LVs in a shared VG. A VM snapshot uses external qcow2 overlays, one LV each.
UEFI
The guest NVRAM is saved into a small sidecar LV (vmsnapshot-nvram-). Revert restores it, and delete or expunge removes it.
Locking and migration
Experimental: disk+memory
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?