New strategy for incremental snapshots for CLVM-ng doesn't depend on bitmaps / checkpoint by Pearl1594 · Pull Request #137 · shapeblue/cloudstack · GitHub
This PR introduces a new strategy for implementing incremental snapshots for clvm-ng
Stopped VM case:
Create a staging LV: a fresh empty QCOW2 overlay backed by the current active LV
Export the active LV to NFS: this becomes the new snapshot file (e.g. snap-2.qcow2)
Rebase the staging LV: update its backing pointer from "the old active LV" to "snap-2 on NFS"
Delete the old active LV: the VM disk is now the staging LV
The staging LV is fresh (zero writes), so the next snapshot will only capture new changes
Running VM case:
Create an LVM snapshot: lvcreate --snapshot takes a point-in-time block-level freeze of the LV. This is instantaneous and completely invisible to the VM. The VM keeps writing to the original LV; any blocks it
overwrites get copied to the snapshot's CoW space first.
Export the LVM snapshot to NFS while the VM runs normally: this becomes the new snapshot file
Delete the LVM snapshot (it was only needed for the export window)
Briefly pause the VM (< 1 second) and update the active LV's QCOW2 header to say "my backing is now snap-2 on NFS instead of snap-1", then resume
Volume path in the database is unchanged: the same LV keeps serving the VM
The trade-off vs the stopped path: because the active LV is never replaced with a fresh one, its QCOW2 cluster table accumulates all writes over its lifetime. Each export captures those accumulated writes, so
snapshots grow over time rather than being truly minimal deltas. The data is always correct, just potentially larger than necessary.
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?
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 introduces a new strategy for implementing incremental snapshots for clvm-ng
Stopped VM case:
Running VM case:
overwrites get copied to the snapshot's CoW space first.
The trade-off vs the stopped path: because the active LV is never replaced with a fresh one, its QCOW2 cluster table accumulates all writes over its lifetime. Each export captures those accumulated writes, so
snapshots grow over time rather than being truly minimal deltas. The data is always correct, just potentially larger than necessary.
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?