Skip to content

CLVM/ISO: Ensure volume is created on the same host as the VM being deployed on - #13748

Draft
Pearl1594 wants to merge 1 commit into
mainfrom
clvm-iso-deploy-fix
Draft

CLVM/ISO: Ensure volume is created on the same host as the VM being deployed on#13748
Pearl1594 wants to merge 1 commit into
mainfrom
clvm-iso-deploy-fix

Conversation

@Pearl1594

Copy link
Copy Markdown
Contributor

Description

This PR fixes: #13747

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?

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 addresses CLVM/CLVM-NG deployment failures for VMs deployed from ISO by attempting to ensure the newly created (templateless) volume is created/locked on the same host that will start the VM, avoiding LV exclusive-activation conflicts across hosts.

Changes:

  • Add CLVM pool detection in the templateId == null (templateless/ISO-style) volume creation path.
  • Set destinationHostId and persist a CLVM lock-host hint prior to createVolumeAsync(...) for that path.
Comments suppressed due to low confidence (1)

engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java:2033

  • The CLVM host pinning here uses vm.getVirtualMachine().getHostId(), which may be null or reflect a previous host during deployment/recreate flows. In this method you already have the planned deploy destination (DeployDestination dest) and use dest.getHost() elsewhere; the CLVM lock should be based on the destination host to ensure the LV is activated on the same host that will start the VM (the issue being fixed).
                StoragePoolVO poolVO = _storagePoolDao.findById(destPool.getId());
                if (poolVO != null && ClvmPoolManager.isClvmPoolType(poolVO.getPoolType())) {
                    Long hostId = vm.getVirtualMachine().getHostId();
                    if (hostId != null) {
                        volume.setDestinationHostId(hostId);

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

Comment on lines +2028 to +2032
// CLVM: pin templateless volume creation to the deploy host
StoragePoolVO poolVO = _storagePoolDao.findById(destPool.getId());
if (poolVO != null && ClvmPoolManager.isClvmPoolType(poolVO.getPoolType())) {
Long hostId = vm.getVirtualMachine().getHostId();
if (hostId != null) {
@codecov

codecov Bot commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 19.64%. Comparing base (4f11707) to head (734640d).

Files with missing lines Patch % Lines
...stack/engine/orchestration/VolumeOrchestrator.java 0.00% 8 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #13748      +/-   ##
============================================
- Coverage     19.65%   19.64%   -0.01%     
+ Complexity    19792    19790       -2     
============================================
  Files          6368     6368              
  Lines        574881   574889       +8     
  Branches      70351    70353       +2     
============================================
- Hits         112970   112963       -7     
- Misses       449639   449655      +16     
+ Partials      12272    12271       -1     
Flag Coverage Δ
uitests 3.41% <ø> (ø)
unittests 20.92% <0.00%> (-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.

@weizhouapache weizhouapache added this to the 4.23.0 milestone Jul 30, 2026
@weizhouapache

Copy link
Copy Markdown
Member

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@weizhouapache 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

@github-actions

Copy link
Copy Markdown

🔴 Test Coverage Grade: D — Marginal

Metric Value
Line coverage 24.50%
Branch coverage 18.67%

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 18712

@weizhouapache

Copy link
Copy Markdown
Member

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

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

@weizhouapache weizhouapache left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

code lgtm

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.

Issue with deployment of VM ffrom ISO may sometimes fail on CLVM pool type

4 participants