Skip to content

Infer single conversion storage pool for VMware import - #13235

Open
andrijapanicsb wants to merge 2 commits into
apache:mainfrom
andrijapanicsb:vddk-auto-select-single-pool
Open

andrijapanicsb wants to merge 2 commits into
apache:mainfrom
andrijapanicsb:vddk-auto-select-single-pool

Conversation

@andrijapanicsb

Copy link
Copy Markdown
Contributor

Description

This improves the VMware import workflow when forceconverttopool=true and the caller does not provide convertinstancepoolid.

Previously, the API always failed in that case, even when the destination environment had exactly one suitable primary storage pool. With this change, CloudStack infers that single suitable pool and proceeds. If no suitable pool exists, or if multiple suitable pools exist, the API still fails with a clear message so the caller can provide convertinstancepoolid explicitly.

No API parameters are added or removed.

API behavior

When forceconverttopool=true:

  • If convertinstancepoolid is supplied, the selected pool is used and validated as before.
  • If convertinstancepoolid is omitted and exactly one suitable KVM primary storage pool exists for the destination cluster or zone, that pool is used automatically.
  • If no suitable pool exists, the request fails with a clear error.
  • If multiple suitable pools exist, the request fails and asks the caller to provide convertinstancepoolid.

UI behavior

  • Direct conversion opens the primary storage selection path.
  • If the returned storage-pool list contains exactly one pool, the UI selects it automatically.
  • If multiple pools are available, the operator still chooses the intended pool.

Testing

  • mvn -pl server -am -Dtest=UnmanagedVMsManagerImplTest -DfailIfNoTests=false -Dsurefire.failIfNoSpecifiedTests=false test

@andrijapanicsb
andrijapanicsb requested review from harikrishna-patnala and nvazquez and removed request for nvazquez May 25, 2026 18:33
@codecov

codecov Bot commented May 25, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.10345% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 20.78%. Comparing base (c5bd11a) to head (699311b).

Files with missing lines Patch % Lines
.../apache/cloudstack/vm/UnmanagedVMsManagerImpl.java 93.10% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               main   #13235   +/-   ##
=========================================
  Coverage     20.77%   20.78%           
- Complexity    20855    20872   +17     
=========================================
  Files          6053     6053           
  Lines        548230   548272   +42     
  Branches      73237    73244    +7     
=========================================
+ Hits         113903   113956   +53     
+ Misses       420988   420969   -19     
- Partials      13339    13347    +8     
Flag Coverage Δ
uitests 3.86% <ø> (-0.01%) ⬇️
unittests 22.22% <93.10%> (+<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.

@andrijapanicsb

Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@andrijapanicsb 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.

@blueorangutan

Copy link
Copy Markdown

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

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 the VMware→KVM import flow when forceconverttopool=true and no explicit convertinstancepoolid is provided, by inferring a single eligible primary storage pool when exactly one candidate exists. It also updates the UI to auto-select the only returned pool and to drive users into the primary-storage selection path when forced conversion is enabled.

Changes:

  • Server: infer an implicit conversion storage pool ID when forced conversion is enabled and exactly one eligible pool exists (cluster/zone scope).
  • Server: add unit tests covering implicit pool resolution behavior.
  • UI: centralize conversion-pool selection sync and auto-select the single available pool; auto-open primary storage selection for forced conversion/VDDK.

Reviewed changes

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

File Description
ui/src/views/tools/ImportUnmanagedInstance.vue Adds centralized pool-selection sync and auto-selection behavior; forces primary pool selection path when forceconverttopool / VDDK is enabled.
server/src/test/java/org/apache/cloudstack/vm/UnmanagedVMsManagerImplTest.java Adds tests for implicit conversion storage pool resolution behavior.
server/src/main/java/org/apache/cloudstack/vm/UnmanagedVMsManagerImpl.java Adds logic to resolve an implicit conversion storage pool ID before validating the pool for forced conversion.

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

Comment on lines +1826 to +1833
List<StoragePoolVO> candidatePools = getImplicitForceConvertToPoolStoragePools(destinationCluster);
if (candidatePools.isEmpty()) {
logFailureAndThrowException(String.format("The parameter forceconverttopool is set to true, but no suitable primary storage pool was found in cluster %s",
destinationCluster.getName()));
}
if (candidatePools.size() > 1) {
logFailureAndThrowException(String.format("The parameter forceconverttopool is set to true, but multiple suitable primary storage pools were found in cluster %s. Please provide convertinstancepoolid.",
destinationCluster.getName()));
Comment on lines +1204 to +1207
selectPrimaryStorageForForcedConversion () {
this.selectedStorageOptionForConversion = 'primary'
this.showStoragePoolsForConversion = true
this.fetchStoragePoolsForConversion()
@weizhouapache weizhouapache added this to the 4.24.0 milestone Jun 29, 2026
@DaanHoogland DaanHoogland moved this from Backlog to Ready in CloudStack Testing Aug 31, 2026
@abh1sar abh1sar moved this from Ready to In progress in CloudStack Testing Sep 7, 2026
@abh1sar

abh1sar commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@abh1sar 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.

@blueorangutan

Copy link
Copy Markdown

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

@abh1sar abh1sar 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.

LGTM. reviewed and tested.

Testing:
Selected forceconverttopool option but didn't select a specific pool.

TC1
Eligible pools: 2
Result: Failed as expected - "The parameter forceconverttopool is set to true, but
multiple suitable primary storage pools were found in cluster p1-c1. Please provide
convertinstancepoolid."

TC2
Eligible pools: 1
Result: VM imported successfully auto selecting the one eligible storage pool.

TC3
Eligible pools: 0
Result: Failed as expected - "...but no suitable primary storage pool was found in cluster p1-c1"

@abh1sar

abh1sar commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

@blueorangutan test

@abh1sar abh1sar moved this from In progress to In review in CloudStack Testing Sep 9, 2026
@blueorangutan

Copy link
Copy Markdown

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

@abh1sar

abh1sar commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

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

@blueorangutan

Copy link
Copy Markdown

[SF] Trillian Build Failed (tid-16975)

@abh1sar

abh1sar commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@abh1sar 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.

@blueorangutan

Copy link
Copy Markdown

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

@github-actions

Copy link
Copy Markdown

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

@github-actions

Copy link
Copy Markdown

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

@nvazquez

Copy link
Copy Markdown
Contributor

Hi @andrijapanicsb can you please address the conflicts?

Resolve an omitted conversion pool before detecting direct RBD/Linstor imports, preserving the updated VDDK and disk-offering validation calls.

Use mode-specific pool types for inference so VDDK considers RBD and Linstor alongside filesystem pools. Preserve explicit pool selection, staged conversion, and ambiguity errors.

Add focused inference and import-path regression coverage.
@andrijapanicsb

Copy link
Copy Markdown
Contributor Author

@ACSHomeBot package G

@ACSHomeBot

ACSHomeBot commented Nov 16, 2026 •

Copy link
Copy Markdown

Accepted: package kvm G for 699311b77dbc.

Planned: RPM + DEB, KVM SystemVM.

Status: Completed. Packaging results.

@ACSHomeBot

Copy link
Copy Markdown

Packaging results:

Result Artifact Platform Build Time
PASS RPM EL (EL8/9/10) 29 min
PASS DEB Ubuntu, Debian 21 min

Test packages are available at:

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

Status: In review

Development

Successfully merging this pull request may close these issues.

8 participants