Repository navigation
Conversation
Script.runSimpleBashScriptWithFullResult now includes error output in exceptions, enabling retry logic for transient virsh errors. Snapshot markers store VM name, disk label, overlay path for recovery. reconcileSnapshotMarkers() fully implemented with blockcommit for running VMs and qemu-img commit for offline cases. Agent reconnects instead of System.exit(1) on ReadyCommand failure. Removed duplicate SNAPSHOT_MARKER_DIR constant.
|
Congratulations on your first Pull Request and welcome to the Apache CloudStack community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md)
|
JoaoJandre
self-requested a review
November 13, 2026 12:58
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #14697 +/- ##
============================================
- Coverage 20.77% 20.76% -0.01%
+ Complexity 20847 20846 -1
============================================
Files 6053 6053
Lines 548222 548428 +206
Branches 73236 73268 +32
============================================
- Hits 113896 113895 -1
- Misses 420984 421191 +207
Partials 13342 13342
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:
|
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 fixes a data loss problem that shows up when a volume snapshot of a
running VM gets interrupted midway, either because the agent dies or the merge
fails silently. In that situation the VM keeps running off an overlay file,
but volumes.path is still pointing at the base. So the next time the VM
starts, it comes up on the base and all the writes that went to the overlay
are gone, with nothing telling you it happened.
There are a few parts to the fix. Script.runSimpleBashScriptWithFullResult()
now carries the actual virsh error output in the exception it throws. Before
this the retry logic had nothing to match against, so now it can recognise the
transient ones like "disk already in active block job" and retry properly. The
snapshot markers also store vmName, diskLabel and overlayPath now, which gives
reconcileSnapshotMarkers() enough to work with, and that method is implemented
fully in this PR. For a running VM that is sitting on an overlay it does a
blockcommit, and for the offline case it falls back to qemu-img commit, with
safety checks so a modified base file is never overwritten.
Along with that, waitForCommandsAndExit is now waitForCommandsAndReconnect. It
calls reconnect() instead of System.exit(1), because exiting was killing
snapshot merges that were still in flight. And there was a duplicate
SNAPSHOT_MARKER_DIR constant that was breaking the build, so that is removed.
Fixes: #14691
Types of changes