Skip to content

CLVM: Fix volume mapping and disk path matching for storage migration#13468

Draft
Pearl1594 wants to merge 2 commits into
mainfrom
minor-improvements-clvm
Draft

CLVM: Fix volume mapping and disk path matching for storage migration#13468
Pearl1594 wants to merge 2 commits into
mainfrom
minor-improvements-clvm

Conversation

@Pearl1594

Copy link
Copy Markdown
Contributor

Description

This PR addresses:

  • Issue with migration of VM with volume - where in if a vm has many disks, and only one or few are migrated, the others need to still be considered for lock transfer
  • Attach operation - if the volume is on another pool, lock transfer needs to take place for successful attach
  • removes an unnecessary check on clvm during snapshot revert
  • properly checks disk path with volume path - so that it doesn't need to do vgs operation
  • Improves clvm cold migration, by updating the lock host id, post migration, so that any operation being performed on this volume (detached) will have the lock host detail and a fan out operation may not be required.

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?

@codecov

codecov Bot commented Jun 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 19.23077% with 21 lines in your changes missing coverage. Please review.
✅ Project coverage is 18.89%. Comparing base (ce2d890) to head (559f415).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...tack/storage/motion/AncientDataMotionStrategy.java 0.00% 15 Missing ⚠️
...e/driver/CloudStackPrimaryDataStoreDriverImpl.java 0.00% 3 Missing ⚠️
...n/java/com/cloud/vm/VirtualMachineManagerImpl.java 50.00% 0 Missing and 1 partial ⚠️
...e/cloudstack/storage/volume/VolumeServiceImpl.java 80.00% 0 Missing and 1 partial ⚠️
...ervisor/kvm/resource/LibvirtComputingResource.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               main   #13468   +/-   ##
=========================================
  Coverage     18.89%   18.89%           
- Complexity    18223    18228    +5     
=========================================
  Files          6174     6174           
  Lines        555226   555244   +18     
  Branches      67774    67778    +4     
=========================================
+ Hits         104885   104896   +11     
- Misses       438820   438826    +6     
- Partials      11521    11522    +1     
Flag Coverage Δ
uitests 3.53% <ø> (ø)
unittests 20.09% <19.23%> (+<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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR improves CLVM behavior around storage migration/attach by refining when volumes are mapped for migration, updating CLVM lock-host tracking after volume moves, and simplifying endpoint selection during snapshot revert.

Changes:

  • Simplifies revertSnapshot endpoint selection by removing a CLVM-specific branch and consistently selecting based on snapshotOnPrimaryStore vs base volume.
  • Improves CLVM lock-host handling: detect when cross-pool lock transfer is required and persist lock-host updates after volume copy/migration.
  • Expands KVM migration volume-to-pool mapping to include CLVM pools and adjusts CLVM disk-path matching logic.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
plugins/storage/volume/default/src/main/java/org/apache/cloudstack/storage/datastore/driver/CloudStackPrimaryDataStoreDriverImpl.java Removes CLVM-only endpoint selection during snapshot revert, selecting endpoint based on snapshot-on-primary presence.
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java Updates CLVM disk-path matching logic used to detect CLVM volumes during migration handling.
engine/storage/volume/src/main/java/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java Adds cross-pool lock-transfer detection based on tracked/derived CLVM lock host vs VM host.
engine/storage/datamotion/src/main/java/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java Persists CLVM lock-host ID after successful volume copy/migrate operations to reduce fan-out/extra discovery.
engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java Ensures volumes on CLVM pools are included in volume-to-pool mapping for KVM migrations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 7024 to 7027
VolumeObjectTO volumeTO = (VolumeObjectTO) diskTO.getData();
if (!diskPath.equals(volumeTO.getPath()) && !diskPath.equals(diskTO.getPath())) {
if (!diskPath.substring(diskPath.lastIndexOf(File.separator) + 1).equals(volumeTO.getPath())) {
continue;
}
@Pearl1594

Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@Pearl1594 a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
15.6% Coverage on New Code (required ≥ 40%)

See analysis details on SonarQube Cloud

@github-actions

Copy link
Copy Markdown

🔴 Test Coverage Grade: D — Marginal

Metric Value
Line coverage 23.51%
Branch coverage 17.70%

Grade Scale

Grade Line Coverage Meaning
🟢 A ≥ 80% Excellent - this code sleeps well at night 😴
🟡 B 60-79% Good - almost there, don't stop now 😉
🟠 C 40-59% Acceptable - your code is wearing a seatbelt, but no airbags 😬
🔴 D 20-39% Marginal - boldly shipping where no test has gone before 🖖
⛔ F < 20% Failing - tests? what tests? 🔥

Branch coverage is shown as a secondary signal. Grade is determined by line coverage.
View full Actions run

@blueorangutan

Copy link
Copy Markdown

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

@Pearl1594

Copy link
Copy Markdown
Contributor Author

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

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

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