| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
importVm with importsource=shared on KVM failed to adopt an existing ROOT volume located on an RBD (Ceph) primary storage pool, returning "Disk not found or is invalid" (jobresultcode 530). Two changes fix this: 1. LibvirtCheckVolumeCommandWrapper only whitelisted file-based pools (Filesystem, NetworkFilesystem, SharedMountPoint) and inspected the volume with direct file reads (checkQcow2File / getVirtualSizeFromFile), which do not work on RBD. RBD is now supported: the volume is inspected through the RBD URI via qemu-img (the same approach already used by LibvirtGetVolumesOnStorageCommandWrapper, which backs listVolumesForImport), the QCOW2 check is skipped for raw RBD images, the virtual size is taken from the pool-reported disk, and the encrypted/backing-file/locked details are still collected so the management server import validations keep working. 2. VolumeOrchestrator.importVolume() and updateImportedVolume() hardcoded the KVM volume format to QCOW2. RBD-backed volumes are raw, so the format is now derived from the storage pool type (RBD -> RAW) through a single shared helper, applied at both import call sites. Unit tests: new LibvirtCheckVolumeCommandWrapperTest and additional VolumeOrchestratorTest cases for the format helper.
Codecov Report❌ Patch coverage is 83.33333% with 3 lines in your changes missing coverage. Please review. @@ Coverage Diff @@
## 4.22 #13365 +/- ##
============================================
+ Coverage 17.67% 17.68% +0.01%
- Complexity 15792 15808 +16
============================================
Files 5922 5922
Lines 533165 533181 +16
Branches 65208 65211 +3
============================================
+ Hits 94242 94309 +67
+ Misses 428276 428221 -55
- Partials 10647 10651 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness.
|
Sorry, something went wrong.
importVolume (managing a previously-unmanaged volume) routes through VolumeOrchestrator.importVolume() and therefore also benefits from the pool-type-aware format fix (RBD -> RAW). Add a VolumeImportUnmanageManagerImplTest case asserting the RBD pool type and KVM hypervisor are forwarded to the orchestrator.
|
@andrijapanicsb a [SL] Jenkins job has been kicked to build packages. It will be bundled with kvm SystemVM template(s). I'll keep you posted as I make progress. |
Sorry, something went wrong.
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 18172 |
Sorry, something went wrong.
|
This looks good! The SQL statements, shouldn't that be part of the upgrade DB? |
Sorry, something went wrong.
Yep, not sure if we have the upgrade path, since this is targeted against 4.22 branch - we should move it there. I would appreciate code-review @wido if you have some time - that being said.... #13294 :) |
Sorry, something went wrong.
|
@blueorangutan test ol9 kvm-ol9 keepEnv |
Sorry, something went wrong.
|
@andrijapanicsb a [SL] Trillian-Jenkins test job (ol9 mgmt + kvm-ol9) has been kicked to run smoke tests |
Sorry, something went wrong.
There was a problem hiding this comment.
Code looks good to me
Sorry, something went wrong.
|
[SF] Trillian test result (tid-16256)
|
Sorry, something went wrong.
There was a problem hiding this comment.
clgtm
Sorry, something went wrong.
|
Withdrawing to rework this internally; will resubmit later. |
Sorry, something went wrong.
@andrijapanicsb |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Description
This PR allows KVM volume import on RBD (Ceph) primary storage to correctly adopt and record existing volumes. It covers two related flows that share the same code paths:
A) importVm (importsource=shared, KVM) adopting an existing ROOT volume on RBD — previously failed with Disk not found or is invalid (jobresultcode 530).
B) importVolume (managing a previously-unmanaged volume) on RBD — previously succeeded but recorded the wrong volume format (QCOW2 instead of RAW).
Two things were responsible:
Agent side (flow A) — LibvirtCheckVolumeCommandWrapper (which backs the CheckVolumeCommand issued during import) only whitelisted file-based pools (Filesystem, NetworkFilesystem, SharedMountPoint) and inspected the volume with direct file reads (checkQcow2File / getVirtualSizeFromFile). Those do not work on RBD, so the command returned Unsupported Storage Pool, the server-side instanceof CheckVolumeAnswer cast failed, and the import was rolled back with Disk not found or is invalid.
RBD is now supported by inspecting the volume through the RBD URI via qemu-img — the same approach already used by LibvirtGetVolumesOnStorageCommandWrapper, which backs listVolumesForImport and already works on RBD. For raw RBD images the QCOW2 validation is skipped, the virtual size comes from the pool-reported disk, and the encrypted / backing-file / locked details are still collected so the existing server-side import validations keep working.
Server / engine side (flows A and B) — VolumeOrchestrator.importVolume() and updateImportedVolume() hardcoded the KVM volume format to QCOW2. RBD-backed volumes are RAW. The format is now derived from the storage pool type (RBD → RAW) via a single shared helper, applied at both import call sites. Because the standalone importVolume API (VolumeImportUnmanageManagerImpl → volumeManager.importVolume(...)) goes through the same method, managing a previously-unmanaged RBD volume now also records it as RAW.
No new server-side guardrails were required: importKVMSharedDisk is already pool-type agnostic and passes the pool type through.
Upgrading existing (already-imported) volumes
This is a fix at import time; it does not retroactively rewrite volumes that were imported/managed before the fix and recorded as QCOW2. RBD/Ceph stores raw block images, so any volume on an RBD pool recorded as QCOW2 is a metadata error and can be corrected with:
This is provided as an operator step rather than an automatic DB migration, because the 4.22 branch does not yet have a 4.22.1.0 → 4.22.2.0 schema-upgrade path scaffolded (the chain currently runs a no-op for that step). It can be promoted to an automatic migration if preferred.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
N/A
How Has This Been Tested?
Unit tests (new + extended), all passing locally on the 4.22 branch (JDK 17, Maven 3.9.9):
To be verified on a KVM + Ceph/RBD environment: (A) importVm with importsource=shared adopting an existing ROOT volume on an RBD pool now succeeds and the resulting volume is recorded with format RAW; (B) importVolume of an unmanaged RBD volume records it as RAW.
How did you try to break this feature and the system with this change?