Infer single conversion storage pool for VMware import#13235
Infer single conversion storage pool for VMware import#13235andrijapanicsb wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #13235 +/- ##
============================================
- Coverage 18.10% 18.10% -0.01%
- Complexity 16746 16751 +5
============================================
Files 6037 6037
Lines 542933 542974 +41
Branches 66487 66493 +6
============================================
+ Hits 98283 98290 +7
- Misses 433602 433641 +39
+ Partials 11048 11043 -5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@blueorangutan package |
|
@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. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✖️ debian ✔️ suse15. SL-JID 18022 |
There was a problem hiding this comment.
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.
| 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())); |
| selectPrimaryStorageForForcedConversion () { | ||
| this.selectedStorageOptionForConversion = 'primary' | ||
| this.showStoragePoolsForConversion = true | ||
| this.fetchStoragePoolsForConversion() |
Description
This improves the VMware import workflow when
forceconverttopool=trueand the caller does not provideconvertinstancepoolid.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
convertinstancepoolidexplicitly.No API parameters are added or removed.
API behavior
When
forceconverttopool=true:convertinstancepoolidis supplied, the selected pool is used and validated as before.convertinstancepoolidis omitted and exactly one suitable KVM primary storage pool exists for the destination cluster or zone, that pool is used automatically.convertinstancepoolid.UI behavior
Testing
mvn -pl server -am -Dtest=UnmanagedVMsManagerImplTest -DfailIfNoTests=false -Dsurefire.failIfNoSpecifiedTests=false test