Skip to content

treat a multipath map with no active paths as not connected on kvm - #14861

Open
Damans227 wants to merge 1 commit into
apache:4.22from
Damans227:kvm-multipath-stale-map
Open

Damans227 wants to merge 1 commit into
apache:4.22from
Damans227:kvm-multipath-stale-map

Conversation

@Damans227

Copy link
Copy Markdown
Collaborator

Fixes #14860

A multipath map that has lost all its paths still passes the block device check, so CloudStack skips discovery and hands the dead disk to the VM or to the template copy. This treats a map with no active paths as not connected, and connectVolume.sh now flushes such a map before scanning so it gets rebuilt. The wait loop also checks the device directly instead of calling back into the connect path.

  • isConnected() also checks that multipath -ll shows an active ready path
  • connectVolume.sh flushes a map with no active paths before scanning
  • waitForDiskToBecomeAvailable() checks the device directly and keeps retrying instead of stopping after one try

If the dead map cant be flushed because something still holds it open, the attach does not succeed on the dead disk. It keeps retrying with a warning in agent.log until the existing retry limit runs out.

Test:

KVM host with a FlashArray FibreChannel volume. Attach it to a VM, hold the map open on the host (sleep 10800 < /dev/mapper/3<wwid> &), detach it so the map is left with no paths, then attach it again.

Before: attach succeeds on the dead map.

3624a937049646854b0ae410b0001171b dm-10 ##,##
0 bytes copied
vdb   /dev/mapper/3624a937049646854b0ae410b0001171b

before

After: while the map is held, the agent refuses it instead of attaching it:

WARN  [kvm.storage.MultipathSCSIAdapterBase] Device /dev/mapper/3624a937049646854b0ae410b0001171b exists but has no active paths, treating it as not connected

Once the map is released, connectVolume.sh flushes it, rescans, and the attach finishes on a healthy map:

18:08:56 CS_SCSI_VOL_FIND: 624a937049646854b0ae410b0001171b awaiting disk path ... not available yet, triggering scan
18:09:03 CS_SCSI_VOL_FIND: 624a937049646854b0ae410b0001171b successfully discovered and available
3624a937049646854b0ae410b0001171b dm-10 PURE,FlashArray
1048576 bytes (1.0 MB, 1.0 MiB) copied

after-rediscovered

after-attach

Also added unit tests for the connected check.

@codecov

codecov Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 38.88889% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 18.35%. Comparing base (6489766) to head (89802fe).

Files with missing lines Patch % Lines
...pervisor/kvm/storage/MultipathSCSIAdapterBase.java 38.88% 11 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               4.22   #14861      +/-   ##
============================================
+ Coverage     18.34%   18.35%   +0.01%     
- Complexity    16669    16673       +4     
============================================
  Files          5939     5939              
  Lines        537819   537830      +11     
  Branches      65941    65943       +2     
============================================
+ Hits          98638    98726      +88     
+ Misses       427960   427877      -83     
- Partials      11221    11227       +6     
Flag Coverage Δ
uitests 4.08% <ø> (ø)
unittests 19.44% <38.88%> (+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.

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