You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by "rajujith (via GitHub)" <gi...@apache.org> on 2026/10/19 07:30:31 UTC
[PR] importVm: make clusterid optional [cloudstack]
rajujith opened a new pull request, #14435:
URL: https://github.com/apache/cloudstack/pull/14435
### Description
This PR makes the `clusterid` parameter of the `importVm` API optional.
`ImportVmCmd` extends `ImportUnmanagedInstanceCmd` and inherits `clusterid` with `required = true`, so every `importVm` call must pass a valid cluster UUID. However, for `importsource=external`, `local` and `shared` (`importKvmInstance()`), the value is never read:
- For `local` / `shared` disk imports, the deployment plan is built from the storage pool's pod and cluster (and `hostid` for local storage), not from `clusterid`.
- For `external`, the instance is fetched from the remote host given by `host`.
Only `importsource=vmware` and `unmanaged` (`baseImportInstance()`) use the cluster. Those paths already reject a missing cluster in `basicAccessChecks()`. This PR keeps that check and changes its message to name the `clusterid` parameter.
`importUnmanagedInstance` shares the same parameter field, so the API doc now lists `clusterid` as optional there too. The server still rejects a call without it, with an `InvalidParameterValueException` instead of the generic missing-parameter error, and the parameter description says when it is required.
Before this change, for example:
```
command=importVm&importsource=shared&hypervisor=kvm&diskpath=...&storageid=...&networkid=...&zoneid=...
-> 431: Unable to execute API command importvm due to missing parameter clusterid
```
After this change the call succeeds without `clusterid`. Requests that pass it are unaffected, so the UI (which always sends it) keeps working.
### Types of changes
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] New feature (non-breaking change which adds functionality)
- [x] 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
#### Bug Severity
- [ ] BLOCKER
- [ ] Critical
- [ ] Major
- [x] Minor
- [ ] Trivial
### How Has This Been Tested?
Unit tests in `UnmanagedVMsManagerImplTest` (95 tests, all passing):
- `importFromLocalDisk` / `importFromsharedStorage` now also check that `getClusterId()` is never called on the import path.
- New `testImportVmFromVmwareMissingClusterId` and `testImportVmFromUnmanagedMissingClusterId` check that VMware and unmanaged imports without `clusterid` still fail with `InvalidParameterValueException`.
#### How did you try to break this feature and the system with this change?
Checked every caller of `getClusterId()` on the import commands: only `baseImportInstance()` (VMware/unmanaged) and `listUnmanagedInstances` read it, and both already check for null.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] importVm: make clusterid optional [cloudstack]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #14435:
URL: https://github.com/apache/cloudstack/pull/14435#issuecomment-6262733621
## [Codecov](https://app.codecov.io/gh/apache/cloudstack/pull/14435?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 4.04%. Comparing base ([`99f348e`](https://app.codecov.io/gh/apache/cloudstack/commit/99f348e0f94681a35a03fcb885af61d0c61305f2?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`684e18f`](https://app.codecov.io/gh/apache/cloudstack/commit/684e18f838b2d1070259a309396f55daa0533515?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
> :exclamation: There is a different number of reports uploaded between BASE (99f348e) and HEAD (684e18f). Click for more details.
>
> <details><summary>HEAD has 1 upload less than BASE</summary>
>
>| Flag | BASE (99f348e) | HEAD (684e18f) |
>|------|------|------|
>|unittests|1|0|
></details>
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## 4.22 #14435 +/- ##
=============================================
- Coverage 18.03% 4.04% -14.00%
=============================================
Files 5937 449 -5488
Lines 536832 38284 -498548
Branches 65793 7083 -58710
=============================================
- Hits 96802 1547 -95255
+ Misses 428977 36522 -392455
+ Partials 11053 215 -10838
```
| [Flag](https://app.codecov.io/gh/apache/cloudstack/pull/14435/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [uitests](https://app.codecov.io/gh/apache/cloudstack/pull/14435/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `4.04% <ø> (ø)` | |
| [unittests](https://app.codecov.io/gh/apache/cloudstack/pull/14435/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/cloudstack/pull/14435?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org