Skip to content

Resync VM snapshot merge process after failure - #14502

Open
JoaoJandre wants to merge 3 commits into
apache:4.22from
scclouds:sync-vmsnapshot-merge-failure
Open

JoaoJandre wants to merge 3 commits into
apache:4.22from
scclouds:sync-vmsnapshot-merge-failure

Conversation

@JoaoJandre

Copy link
Copy Markdown
Contributor

Description

This PR fixes #14030 and #14019

If the process for a disk-only VM snapshot merge fails for any reason and the process was already partially done, e.g. one of the VM's volumes was already merged, this may cause a de-synchronization between what the Management Server and the VM's actual metadata.

This PR enhances the merge process so that if a previous merge attempt failed or stopped in the middle of the process, we can try again.

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?

  1. With a running VM, I created and deleted a VM snapshot
  2. With a running VM, I created a VM snapshot; wrote some files into the VM; started the deletion process and restarted the Management Server before it finished. I then tried the process again and it finished correctly
  3. With a running VM, I created a VM snapshot; wrote some files into the VM; started the deletion process and restarted the Agent before it finished. I then tried the process again and it finished correctly
  4. I lowered the timeout to 5 seconds. With a running VM, I added a second volume to the VM; I created a VM snapshot; wrote a lot of stuff to the second volume; deleted the VM snapshot. The first volume was merged but the second one timed out. I raised the timeout to 500 seconds and tried again, and the process finished correctly.

I repeated the tests using libvirt.events.enabled as true. I also repeated the tests with a stopped VM.

@JoaoJandre

Copy link
Copy Markdown
Contributor Author

@abh1sar Can you review?

@JoaoJandre

Copy link
Copy Markdown
Contributor Author

@vladimirpetrov #14030 and #14019 are fixed by this and multiple users have reported this issue. I feel like this is an important fix to get into 4.22.2. If the community reviews and approves it, could we try to get it into 4.22.2?

@JoaoJandre

Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@JoaoJandre

Copy link
Copy Markdown
Contributor Author

This PR will likely have merge conflicts with main. When it gets merged into 4.22.2, I can merge it forward to main.

@JoaoJandre
JoaoJandre requested a review from Damans227 October 26, 2026 19:45
@codecov

codecov Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 31.63265% with 67 lines in your changes missing coverage. Please review.
✅ Project coverage is 18.31%. Comparing base (30ed411) to head (febad40).
⚠️ Report is 4 commits behind head on 4.22.

Files with missing lines Patch % Lines
.../LibvirtMergeDiskOnlyVMSnapshotCommandWrapper.java 15.51% 49 Missing ⚠️
...ervisor/kvm/resource/LibvirtComputingResource.java 7.14% 13 Missing ⚠️
...napshot/KvmFileBasedStorageVmSnapshotStrategy.java 0.00% 4 Missing ⚠️
...ud/hypervisor/kvm/storage/KVMStorageProcessor.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               4.22   #14502      +/-   ##
============================================
+ Coverage     18.26%   18.31%   +0.04%     
- Complexity    16608    16636      +28     
============================================
  Files          5939     5939              
  Lines        537697   537828     +131     
  Branches      65922    65937      +15     
============================================
+ Hits          98210    98489     +279     
+ Misses       428299   428131     -168     
- Partials      11188    11208      +20     
Flag Coverage Δ
uitests 4.08% <ø> (ø)
unittests 19.40% <31.63%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JoaoJandre

Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@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.

@blueorangutan

Copy link
Copy Markdown

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 19775

@JoaoJandre

Copy link
Copy Markdown
Contributor Author

@Damans227 I pushed a new commit addressing your reviews. Could you review again?

@JoaoJandre JoaoJandre added this to the 4.22.2 milestone Oct 27, 2026
@Damans227

Copy link
Copy Markdown
Collaborator

@JoaoJandre this looks good on the code side. can you get it tested on kvm?

@JoaoJandre

Copy link
Copy Markdown
Contributor Author

@JoaoJandre this looks good on the code side. can you get it tested on kvm?

@Damans227 I already tested the PR. The tests are in the description :D

@Damans227

Copy link
Copy Markdown
Collaborator

thanks @JoaoJandre, CLGTM

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants