Skip to content

kvm: resolve RBD disks of unmanaged instances without a mount lookup - #14693

Open
weizhouapache wants to merge 1 commit into
apache:4.22from
weizhouapache:4.22-kvm-rbd-unmanaged-instances
Open

weizhouapache wants to merge 1 commit into
apache:4.22from
weizhouapache:4.22-kvm-rbd-unmanaged-instances

Conversation

@weizhouapache

@weizhouapache weizhouapache commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

listUnmanagedInstances ran a substring mount lookup for every disk. For an RBD disk the pool name 'cloudstack' matched an unrelated NFS mount line, so the disk was reported on that NFS datastore and the import failed with 'Storage pool ... not found'.

RBD disks now take the monitor host and the pool name from the libvirt source. Other disks, including Gluster network disks, keep the mount-based lookup.

Add unit tests for the RBD and Gluster cases.

Description

This PR...

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?

Unit tests (plugins/hypervisors/kvm): LibvirtGetUnmanagedInstancesCommandWrapperTest, 7 tests, all pass. The new cases check that an RBD disk takes the monitor host and pool name from the libvirt source without calling the mount lookup, and that a Gluster disk still uses the mount lookup.

Live test on a Trillian test environment (Ubuntu 26.04, two KVM hosts, Ceph RBD pools, management server and KVM agents built from this change):

  1. Deployed a Tiny VM on an RBD pool.
  2. Unmanaged the VM.
  3. Ran listUnmanagedInstances on its KVM host. The RBD disk now reports datastore host = the Ceph monitor, datastore name and path = the RBD pool, type network, and image path <pool>/<image>.
  4. Imported the VM with importUnmanagedInstance. The import succeeded, the VM ran on RBD, and libvirt still pointed at the same image.
  5. Destroyed and expunged the imported VM.

Before this change the same disk was reported on the NFS mount that matched the pool name, and the import failed. The live run used an earlier build of the agent in which Gluster disks also took the RBD path. The RBD path is the same in both builds.

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

  • Gluster network disks keep the mount-based lookup (unit test).
  • File and block disks are not changed by this PR.
  • Not covered: a live run with a Gluster disk, and a before/after comparison of a file-based disk on the test environment.

listUnmanagedInstances ran a substring mount lookup for every disk. For an
RBD disk the pool name 'cloudstack' matched an unrelated NFS mount line, so
the disk was reported on that NFS datastore and the import failed with
'Storage pool ... not found'.

RBD disks now take the monitor host and the pool name from the libvirt
source. Other disks, including Gluster network disks, keep the mount-based
lookup.

Add unit tests for the RBD and Gluster cases.
@codecov

codecov Bot commented Nov 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 4.08%. Comparing base (b56bbc2) to head (1d34b1f).

❗ There is a different number of reports uploaded between BASE (b56bbc2) and HEAD (1d34b1f). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (b56bbc2) HEAD (1d34b1f)
unittests 1 0
Additional details and impacted files
@@              Coverage Diff              @@
##               4.22   #14693       +/-   ##
=============================================
- Coverage     18.32%    4.08%   -14.24%     
=============================================
  Files          5939      449     -5490     
  Lines        537787    38282   -499505     
  Branches      65932     7083    -58849     
=============================================
- Hits          98544     1564    -96980     
+ Misses       428033    36503   -391530     
+ Partials      11210      215    -10995     
Flag Coverage Δ
uitests 4.08% <ø> (ø)
unittests ?

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.

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.

1 participant