GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — importVM improvements: RBD support, volume format, and cluster selection by abh1sar · Pull Request #14162 · apache/cloudstack

Conversation

@abh1sar

@abh1sar abh1sar commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Description

This PR fixes 3 issues in the importVM workflow:

1. Root disk import doesn't work for RBD pools unlike data disk import

importVolume / listVolumesForImport already accept RBD. LibvirtGetVolumesOnStorageCommandWrapper has handled it all along, including building the rbd: URI for qemu-img info. But importVm importsource=shared rejects it, because the neighbouring LibvirtCheckVolumeCommandWrapper was written with a file-only pool list. An operator on Ceph can import a data disk but not a root disk.

The failure is also misleading. The agent answers "Unsupported Storage Pool", but the operator sees:

CloudRuntimeException: Disk not found or is invalid

and the VM is rolled back.

Adds StoragePoolType.RBD to the check wrapper's supported list, takes the virtual size from the disk libvirt already resolved (qemu-img cannot open a bare RBD image name), skips the QCOW2 header check for raw RBD images, and builds the rbd: URI via the existing KVMPhysicalDisk.RBDStringBuilder.

diskpath on importVm and path on importVolume are the file name on file-based pools and the image name on RBD. Both parameter descriptions now say so.

2. An imported volume records the wrong image format

importVolume and updateImportedVolume both stamped the cluster default format for the hypervisor, so a volume imported from an RBD pool was recorded QCOW2 while a natively deployed volume on the same pool is RAW. Both entry points were affected: root disks via importVm importsource=shared, and data disks via importVolume.

They now record the format the hypervisor reported for the image, from the check answer for a root disk and from the volume listed on the pool for a data disk, falling back to the hypervisor default when none is reported. This also corrects a raw image imported from a file-based pool, so it is a general correctness fix rather than an RBD-specific one.

3. The import is planned outside the pool's cluster

importKVMInstanceFromDiskImage planned with pod and cluster unset, so the planner could pick any host in the zone by capacity, even one in a cluster with no access to the pool the caller named. The volume check then ran against whichever pool that cluster does have, and the import failed with "Disk not found or is invalid" although the image was fine.
This is not RBD-specific. Reproduced on a two-cluster zone with plain NFS.

The plan now takes pod and cluster from the pool the caller passed. Both are null for a zone-wide pool, which every host can see, so that case plans exactly as before.

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. Deployed a VM with a root and data disk on RBD pool
  2. Unmanage it
  3. Import the VM
  4. Checked the guest OS
  5. Took volume snapshots on imported volumes
  6. No failures or errors were observed
  7. Verified the format of the root and data disk was raw
  8. Verified on a two cluster setup that importVM always selects the host that has access to the storage pool.

How did you try to break this feature and the system with this change?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

rajujith reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
abh1sar added 3 commits September 14, 2026 10:04
@abh1sar
kvm: allow importVm importsource=shared from an RBD pool
b40abde
The CheckVolumeCommand wrapper on the KVM agent only accepted file based
pools, so importing a root disk straight from Ceph failed on the agent
with "Unsupported Storage Pool" and surfaced as "Disk not found or is
invalid" on the management server. Add RBD to the supported pool types,
take the virtual size from the disk libvirt resolved (qemu-img cannot
open a bare RBD image name), skip the QCOW2 header check for raw RBD
images, and build the rbd: URI when running qemu-img info, the same way
LibvirtGetVolumesOnStorageCommandWrapper already does for
listVolumesForImport.
@abh1sar
kvm: record the real image format on an imported volume
c2ca38b
importVolume and updateImportedVolume both stamped the cluster default
format for the hypervisor, so a volume imported from an RBD pool was
recorded as QCOW2 while a natively deployed volume on the same pool is
RAW. This affected both entry points: importVm importsource=shared for a
root disk, and importVolume for a data disk.

Pass the format the hypervisor reported for the existing image, from the
check answer for a root disk and from the volume listed on the pool for
a data disk, and fall back to the hypervisor default only when no format
is reported. This also corrects a raw image imported from a file based
pool.
@abh1sar
vm import: plan the instance inside the pod and cluster of the reques…
e8fa17e
…ted pool

importKVMInstanceFromDiskImage planned with the pod and cluster unset, so
the planner was free to pick any host in the zone by capacity. When it
picked a host in a cluster that cannot see the pool the caller named, the
volume check ran against whichever pool that cluster does have, and the
import failed with "Disk not found or is invalid" although the image was
fine.

Take the pod and cluster from the pool the caller passed, the same way
importVolume already derives its host from the pool's scope
@boring-cyborg boring-cyborg Bot added component:api component:kvm component:orchestration component:storage labels Sep 14, 2026
@abh1sar
abh1sar requested review from rajujith and sureshanaparti September 14, 2026 06:15
@codecov

codecov Bot commented Sep 14, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 64.28571% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 17.99%. Comparing base (2e450cb) to head (78ac0f4).
⚠️ Report is 5 commits behind head on 4.22.

Files with missing lines Patch % Lines
...urce/wrapper/LibvirtCheckVolumeCommandWrapper.java 0.00% 14 Missing ⚠️
...stack/engine/orchestration/VolumeOrchestrator.java 25.00% 2 Missing and 1 partial ⚠️
.../apache/cloudstack/vm/UnmanagedVMsManagerImpl.java 89.28% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               4.22   #14162      +/-   ##
============================================
+ Coverage     17.93%   17.99%   +0.05%     
- Complexity    16143    16198      +55     
============================================
  Files          5928     5930       +2     
  Lines        535174   535646     +472     
  Branches      65494    65588      +94     
============================================
+ Hits          95998    96369     +371     
- Misses       428253   428302      +49     
- Partials      10923    10975      +52     
Flag Coverage Δ
uitests 4.02% <ø> (ø)
unittests 19.06% <64.28%> (+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.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@weizhouapache

weizhouapache commented Sep 14, 2026

Copy link
Copy Markdown
Member

nice improvements and fixed @abh1sar

I was thinking of reopening #13365, which is not needed in favor of this.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@weizhouapache

weizhouapache commented Sep 14, 2026

Copy link
Copy Markdown
Member

@blueorangutan package

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@blueorangutan

blueorangutan commented Sep 14, 2026

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

weizhouapache
weizhouapache reviewed Sep 14, 2026
View reviewed changes
Comment thread ...rc/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtCheckVolumeCommandWrapper.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@blueorangutan

blueorangutan commented Sep 14, 2026

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@abh1sar
verify qemu is able to read the rbd image since check can not be done…
8f49d1a
… on a raw file
@abh1sar

abh1sar commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

@blueorangutan package

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@blueorangutan

blueorangutan commented Sep 14, 2026

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@blueorangutan

blueorangutan commented Sep 14, 2026

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@weizhouapache

weizhouapache commented Sep 14, 2026

Copy link
Copy Markdown
Member

@blueorangutan test

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@blueorangutan

blueorangutan commented Sep 14, 2026

Copy link
Copy Markdown

@weizhouapache a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@blueorangutan

blueorangutan commented Sep 15, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

[SF] Trillian test result (tid-16985)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 47797 seconds
Marvin logs: [archive removed]
Smoke tests completed. 149 look OK, 0 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@blueorangutan

blueorangutan commented Sep 15, 2026

Copy link
Copy Markdown

[SF] Trillian Build Failed (tid-16987)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

weizhouapache
weizhouapache reviewed Sep 15, 2026
View reviewed changes
Comment thread ...rc/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtCheckVolumeCommandWrapper.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@weizhouapache weizhouapache self-assigned this Sep 15, 2026
@weizhouapache weizhouapache added the component:ceph label Sep 15, 2026
@abh1sar
use computed volumeDetails in success path as well.
0b898ad
@weizhouapache

weizhouapache commented Sep 15, 2026

Copy link
Copy Markdown
Member

@blueorangutan package

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@blueorangutan

blueorangutan commented Sep 15, 2026

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@blueorangutan

blueorangutan commented Sep 15, 2026

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@abh1sar
ui: do not call the imported disk a QCOW2 image
78ac0f4
The import wizard for local and shared storage described the disk as a
QCOW2 image. An image on an RBD pool is raw, and a raw image on a file
based pool can be imported as well, so the wording is wrong for both.
Call it a disk image instead.

Only the English strings are changed; the other locales come from
Transifex.
@boring-cyborg boring-cyborg Bot added the component:UI label Sep 17, 2026
rajujith
rajujith approved these changes Sep 18, 2026
View reviewed changes

@rajujith rajujith left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM
Tested.
1.Created a vm with data volume on Ceph PS
2. Stopped the VM and unmanaged it
3. Imported VM from the ROOT volume using path
4. Imported the DATA volume using the path
5. Attached the DATA volume on the instance.
6. Started the Instance

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@weizhouapache

weizhouapache commented Sep 18, 2026

Copy link
Copy Markdown
Member

code lgtm

Ran the two relevant Marvin smoke tests against real Ceph/RBD storage, twice (an initial run and a rerun for confirmation):

  • test_vm_lifecycle_unmanage_kvm_import.py — unmanage/re-import a persistent-domain VM (both running and stopped) — 2/2 SUCCESS both times.
  • test_import_unmanage_volumes.py — attach/detach/unmanage/import a volume — 1/1 SUCCESS both times.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

weizhouapache
weizhouapache approved these changes Sep 18, 2026
View reviewed changes
@weizhouapache

weizhouapache commented Sep 18, 2026

Copy link
Copy Markdown
Member

@blueorangutan test

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@blueorangutan

blueorangutan commented Sep 18, 2026

Copy link
Copy Markdown

@weizhouapache a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@weizhouapache weizhouapache added the status:ready-for-merge label Sep 18, 2026
@weizhouapache weizhouapache added this to the 4.22.2 milestone Sep 18, 2026
@abh1sar

abh1sar commented Sep 18, 2026

Copy link
Copy Markdown
Contributor Author

@blueorangutan test

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@blueorangutan

blueorangutan commented Sep 18, 2026

Copy link
Copy Markdown

@abh1sar a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@blueorangutan

blueorangutan commented Sep 18, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

[SF] Trillian test result (tid-17021)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 51323 seconds
Marvin logs: [archive removed]
Smoke tests completed. 149 look OK, 0 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@blueorangutan

blueorangutan commented Sep 18, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

[SF] Trillian test result (tid-17023)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 49497 seconds
Marvin logs: [archive removed]
Smoke tests completed. 149 look OK, 0 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@weizhouapache
weizhouapache merged commit ac8d69c into apache:4.22 Sep 19, 2026
25 of 26 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@DaanHoogland
DaanHoogland deleted the importvm-impr branch September 24, 2026 10:42
weizhouapache pushed a commit to weizhouapache/cloudstack that referenced this pull request Oct 12, 2026
@abh1sar @weizhouapache
importVM improvements: RBD support, volume format, and cluster select…
66e69b5
…ion (apache#14162)

* kvm: allow importVm importsource=shared from an RBD pool

The CheckVolumeCommand wrapper on the KVM agent only accepted file based
pools, so importing a root disk straight from Ceph failed on the agent
with "Unsupported Storage Pool" and surfaced as "Disk not found or is
invalid" on the management server. Add RBD to the supported pool types,
take the virtual size from the disk libvirt resolved (qemu-img cannot
open a bare RBD image name), skip the QCOW2 header check for raw RBD
images, and build the rbd: URI when running qemu-img info, the same way
LibvirtGetVolumesOnStorageCommandWrapper already does for
listVolumesForImport.

* kvm: record the real image format on an imported volume

importVolume and updateImportedVolume both stamped the cluster default
format for the hypervisor, so a volume imported from an RBD pool was
recorded as QCOW2 while a natively deployed volume on the same pool is
RAW. This affected both entry points: importVm importsource=shared for a
root disk, and importVolume for a data disk.

Pass the format the hypervisor reported for the existing image, from the
check answer for a root disk and from the volume listed on the pool for
a data disk, and fall back to the hypervisor default only when no format
is reported. This also corrects a raw image imported from a file based
pool.

* vm import: plan the instance inside the pod and cluster of the requested pool

importKVMInstanceFromDiskImage planned with the pod and cluster unset, so
the planner was free to pick any host in the zone by capacity. When it
picked a host in a cluster that cannot see the pool the caller named, the
volume check ran against whichever pool that cluster does have, and the
import failed with "Disk not found or is invalid" although the image was
fine.

Take the pod and cluster from the pool the caller passed, the same way
importVolume already derives its host from the pool's scope

* verify qemu is able to read the rbd image since check can not be done on a raw file

* use computed volumeDetails in success path as well.

* ui: do not call the imported disk a QCOW2 image

The import wizard for local and shared storage described the disk as a
QCOW2 image. An image on an RBD pool is raw, and a raw image on a file
based pool can be imported as well, so the wording is wrong for both.
Call it a disk image instead.

Only the English strings are changed; the other locales come from
Transifex.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@rajujith rajujith rajujith approved these changes
@weizhouapache weizhouapache weizhouapache approved these changes
@sureshanaparti sureshanaparti Awaiting requested review from sureshanaparti

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@weizhouapache weizhouapache

Labels

component:api component:ceph component:kvm component:orchestration component:storage component:UI status:ready-for-merge

Projects

None yet

Milestone

4.22.2

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@abh1sar @weizhouapache @blueorangutan @rajujith
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.