FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

kvm: remove the partial RBD image when a template copy fails by weizhouapache · Pull Request #14393 · apache/cloudstack · GitHub

Repository navigation

kvm: remove the partial RBD image when a template copy fails - #14393

Open
weizhouapache wants to merge 1 commit into
apache:4.22from
weizhouapache:4.22-rbd-remove-partial-image-on-copy-failure
Open

weizhouapache wants to merge 1 commit into
apache:4.22from
weizhouapache:4.22-rbd-remove-partial-image-on-copy-failure

Conversation

Copy link
Copy Markdown
Member

Description

When qemu-img convert into an RBD pool failed or timed out, the half-written image was left behind. Every later copy of the same template then failed with "rbd create: File exists", so deployments from that template broke on the pool until the image was removed by hand.

  • check whether the destination RBD image exists before converting, and refuse to overwrite it, as it may be a complete image used by clones
  • remove the image again if the copy created it and then failed
  • do not print the Ceph key in the "Failed to convert" error

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?

When qemu-img convert into an RBD pool failed or timed out, the half-written
image was left behind. Every later copy of the same template then failed with
"rbd create: File exists", so deployments from that template broke on the pool
until the image was removed by hand.

- check whether the destination RBD image exists before converting, and refuse
  to overwrite it, as it may be a complete image used by clones
- remove the image again if the copy created it and then failed
- do not print the Ceph key in the "Failed to convert" error

Copy link
Copy Markdown
Member Author

@blueorangutan package

Copy link
Copy Markdown

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

codecov Bot commented Oct 13, 2026 •
edited
Loading

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 6.12245% with 46 lines in your changes missing coverage. Please review.
✅ Project coverage is 18.02%. Comparing base (dfff32e) to head (c9575e0).
⚠️ Report is 26 commits behind head on 4.22.

Files with missing lines Patch % Lines
.../hypervisor/kvm/storage/LibvirtStorageAdaptor.java 6.12% 46 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               4.22   #14393   +/-   ##
=========================================
  Coverage     18.01%   18.02%           
- Complexity    16265    16272    +7     
=========================================
  Files          5936     5936           
  Lines        536395   536442   +47     
  Branches      65701    65705    +4     
=========================================
+ Hits          96658    96695   +37     
- Misses       428710   428719    +9     
- Partials      11027    11028    +1     
Flag Coverage Δ
uitests 4.04% <ø> (ø)
unittests 19.09% <6.12%> (+<0.01%) ⬆️

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.

Copy link
Copy Markdown

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

weizhouapache marked this pull request as ready for review October 13, 2026 18:40
weizhouapache added this to the 4.22.2 milestone Oct 13, 2026
logger.error("Failed to convert from {} to RBD image {} the error was: {}", srcFilename, rbdDestPath, maskRbdKey(e.getMessage()));
newDisk = null;
if (destCreatedByCopy) {
removeRbdImageQuietly(destPool, name);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

what happens on a timeout? qemu-img gets killed, so ceph still sees it on the image for about 30s and the remove here likely fails with "image has watchers"

String srcFilename = srcFile != null ? srcFile.getFileName() : null;
String destFilename = destFile != null ? destFile.getFileName() : null;
logger.error(String.format("Failed to convert from %s to %s the error was: %s", srcFilename, destFilename, e.getMessage()));
logger.error("Failed to convert from {} to RBD image {} the error was: {}", srcFilename, rbdDestPath, maskRbdKey(e.getMessage()));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

should the rbd to rbd copy further down get the same fix? it still logs the key and leaves the image behind when it fails

This branch has not been deployed

No deployments
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL