You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by "shwstppr (via GitHub)" <gi...@apache.org> on 2025/11/04 12:27:15 UTC
[PR] server: control honouring internal IDs by old APIs [cloudstack]
shwstppr opened a new pull request, #11976:
URL: https://github.com/apache/cloudstack/pull/11976
### Description
Fixes #9684
### 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)
- [x] 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?
<!-- Please describe in detail how you tested your changes. -->
<!-- Include details of your testing environment, and the tests you ran to -->
#### How did you try to break this feature and the system with this change?
<!-- see how your change affects other areas of the code, etc. -->
<!-- Please read the [CONTRIBUTING](https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md) document -->
--
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] server: control honouring internal IDs by old APIs [cloudstack]
Posted by "shwstppr (via GitHub)" <gi...@apache.org>.
shwstppr commented on PR #11976:
URL: https://github.com/apache/cloudstack/pull/11976#issuecomment-3822658279
@blueorangutan package
--
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] server: control honouring internal IDs by old APIs [cloudstack]
Posted by "shwstppr (via GitHub)" <gi...@apache.org>.
shwstppr closed pull request #11976: server: control honouring internal IDs by old APIs
URL: https://github.com/apache/cloudstack/pull/11976
--
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] server: control honouring internal IDs by old APIs [cloudstack]
Posted by "shwstppr (via GitHub)" <gi...@apache.org>.
shwstppr commented on code in PR #11976:
URL: https://github.com/apache/cloudstack/pull/11976#discussion_r3568636449
##########
server/src/main/java/com/cloud/api/ApiServer.java:
##########
@@ -348,6 +348,19 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer
, ConfigKey.Scope.Global, null, null, null, null, null, ConfigKey.Kind.Select,
EnumSet.allOf(ApiSessionKeyCheckOption.class).stream().map(Enum::toString).collect(Collectors.joining(", ")));
+ public static final ConfigKey<Boolean> ApiDisallowInternalIds = new ConfigKey<>(
+ ConfigKey.CATEGORY_ADVANCED,
+ Boolean.class,
+ "api.disallow.internal.ids",
+ "false",
Review Comment:
```suggestion
"true",
```
--
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] server: control honouring internal IDs by old APIs [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11976:
URL: https://github.com/apache/cloudstack/pull/11976#issuecomment-3822874231
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 16647
--
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] server: control honouring internal IDs by old APIs [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11976:
URL: https://github.com/apache/cloudstack/pull/11976#issuecomment-3822665415
@shwstppr 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.
--
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] server: control honouring internal IDs by old APIs [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11976:
URL: https://github.com/apache/cloudstack/pull/11976#issuecomment-3829088135
@shwstppr a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests
--
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] server: control honouring internal IDs by old APIs [cloudstack]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #11976:
URL: https://github.com/apache/cloudstack/pull/11976#issuecomment-3485775471
## [Codecov](https://app.codecov.io/gh/apache/cloudstack/pull/11976?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 3.58%. Comparing base ([`bfc4f60`](https://app.codecov.io/gh/apache/cloudstack/commit/bfc4f60e1da8f2c4e686d07a35b213b8cd659ec2?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`77edb37`](https://app.codecov.io/gh/apache/cloudstack/commit/77edb373a0d1183d6338a103ad8d4b82a4b7f56e?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 6 commits behind head on main.
> :exclamation: There is a different number of reports uploaded between BASE (bfc4f60) and HEAD (77edb37). Click for more details.
>
> <details><summary>HEAD has 1 upload less than BASE</summary>
>
>| Flag | BASE (bfc4f60) | HEAD (77edb37) |
>|------|------|------|
>|unittests|1|0|
></details>
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## main #11976 +/- ##
=============================================
- Coverage 17.56% 3.58% -13.98%
=============================================
Files 5909 445 -5464
Lines 529045 37532 -491513
Branches 64615 6901 -57714
=============================================
- Hits 92933 1346 -91587
+ Misses 425657 36022 -389635
+ Partials 10455 164 -10291
```
| [Flag](https://app.codecov.io/gh/apache/cloudstack/pull/11976/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/11976/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `3.58% <ø> (ø)` | |
| [unittests](https://app.codecov.io/gh/apache/cloudstack/pull/11976/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 Sentry](https://app.codecov.io/gh/apache/cloudstack/pull/11976?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
Re: [PR] server: control honouring internal IDs by old APIs [cloudstack]
Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on PR #11976:
URL: https://github.com/apache/cloudstack/pull/11976#issuecomment-3822953122
@nvazquez can you check/review?
--
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] server: control honouring internal IDs by old APIs [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #11976:
URL: https://github.com/apache/cloudstack/pull/11976#issuecomment-3830904318
<b>[SF] Trillian test result (tid-15345)</b>
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 55576 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr11976-t15345-kvm-ol8.zip
Smoke tests completed. 146 look OK, 4 have errors, 0 did not run
Only failed and skipped tests results shown below:
Test | Result | Time (s) | Test File
--- | --- | --- | ---
test_08_arping_in_ssvm | `Failure` | 5.20 | test_diagnostics.py
ContextSuite context=TestListIdsParams>:teardown | `Error` | 1.14 | test_list_ids_parameter.py
test_01_snapshot_root_disk | `Error` | 4.84 | test_snapshots.py
test_02_list_snapshots_with_removed_data_store | `Error` | 49.63 | test_snapshots.py
test_02_list_snapshots_with_removed_data_store | `Error` | 49.63 | test_snapshots.py
ContextSuite context=TestSnapshotStandaloneBackup>:teardown | `Error` | 32.50 | test_snapshots.py
test_01_snapshot_usage | `Error` | 25.76 | test_usage.py
test_01_vpn_usage | `Error` | 1.09 | test_usage.py
--
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] server: control honouring internal IDs by old APIs [cloudstack]
Posted by "shwstppr (via GitHub)" <gi...@apache.org>.
shwstppr commented on PR #11976:
URL: https://github.com/apache/cloudstack/pull/11976#issuecomment-3829084109
@blueorangutan test
--
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] server: control honouring internal IDs by old APIs [cloudstack]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #11976:
URL: https://github.com/apache/cloudstack/pull/11976#discussion_r3568652228
##########
server/src/main/java/com/cloud/api/ApiServer.java:
##########
@@ -348,6 +348,19 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer
, ConfigKey.Scope.Global, null, null, null, null, null, ConfigKey.Kind.Select,
EnumSet.allOf(ApiSessionKeyCheckOption.class).stream().map(Enum::toString).collect(Collectors.joining(", ")));
+ public static final ConfigKey<Boolean> ApiDisallowInternalIds = new ConfigKey<>(
+ ConfigKey.CATEGORY_ADVANCED,
+ Boolean.class,
+ "api.disallow.internal.ids",
+ "true",
+ "When enabled, APIs will not honour requests containing internal database IDs. "
+ + "Only UUIDs will be accepted as entity identifiers. "
+ + "By default, internal IDs are still accepted for backward compatibility with pre-3.x APIs.",
+ true,
+ ConfigKey.Scope.Global
+ );
Review Comment:
The config key’s description says internal IDs are accepted by default for backward compatibility, but the declared default value is "true" (which disallows internal IDs). This is confusing for operators and makes it unclear what behavior to expect out of the box. Update the description (or the default) so they match.
##########
server/src/main/java/com/cloud/api/dispatch/ParamProcessWorker.java:
##########
@@ -510,7 +511,7 @@ private Long translateUuidToInternalId(final String uuid, final Parameter annota
}
Long internalId = null;
// If annotation's empty, the cmd existed before 3.x try conversion to long
- final boolean isPre3x = annotation.since().isEmpty();
+ final boolean isPre3x = annotation.since().isEmpty() && !ApiServer.ApiDisallowInternalIds.value();
Review Comment:
`isPre3x` is now also gated by the global config `api.disallow.internal.ids`, so the name is misleading (it no longer strictly means “API existed before 3.x”). Renaming it to reflect its meaning (whether internal-ID fallback is allowed) will make the control flow and comments easier to understand and maintain.
##########
server/src/main/java/com/cloud/api/dispatch/ParamProcessWorker.java:
##########
@@ -510,7 +511,7 @@ private Long translateUuidToInternalId(final String uuid, final Parameter annota
}
Long internalId = null;
// If annotation's empty, the cmd existed before 3.x try conversion to long
- final boolean isPre3x = annotation.since().isEmpty();
+ final boolean isPre3x = annotation.since().isEmpty() && !ApiServer.ApiDisallowInternalIds.value();
Review Comment:
This change introduces a new config-controlled behavior (rejecting numeric/internal IDs even for pre-3.x APIs), but there are no unit tests covering it. Please add tests that assert: (1) numeric IDs are rejected when `api.disallow.internal.ids=true`, and (2) numeric IDs are still accepted for pre-3.x APIs when the config is set to false (if backward compatibility is intended).
--
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] server: control honouring internal IDs by old APIs [cloudstack]
Posted by "shwstppr (via GitHub)" <gi...@apache.org>.
shwstppr commented on code in PR #11976:
URL: https://github.com/apache/cloudstack/pull/11976#discussion_r3568640673
##########
server/src/main/java/com/cloud/api/ApiServer.java:
##########
@@ -348,6 +348,19 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer
, ConfigKey.Scope.Global, null, null, null, null, null, ConfigKey.Kind.Select,
EnumSet.allOf(ApiSessionKeyCheckOption.class).stream().map(Enum::toString).collect(Collectors.joining(", ")));
+ public static final ConfigKey<Boolean> ApiDisallowInternalIds = new ConfigKey<>(
+ ConfigKey.CATEGORY_ADVANCED,
+ Boolean.class,
+ "api.disallow.internal.ids",
+ "true",
+ "When enabled, APIs will not honour requests containing internal database IDs. "
+ + "Only UUIDs will be accepted as entity identifiers. "
+ + "By default, internal IDs are still accepted for backward compatibility with pre-3.x APIs.",
Review Comment:
```suggestion
+ "By default, internal IDs are not accepted even for pre-3.x APIs.",
```
--
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] server: control honouring internal IDs by old APIs [cloudstack]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #11976:
URL: https://github.com/apache/cloudstack/pull/11976#discussion_r3568687039
##########
server/src/main/java/com/cloud/api/dispatch/ParamProcessWorker.java:
##########
@@ -510,7 +511,7 @@ private Long translateUuidToInternalId(final String uuid, final Parameter annota
}
Long internalId = null;
// If annotation's empty, the cmd existed before 3.x try conversion to long
- final boolean isPre3x = annotation.since().isEmpty();
+ final boolean isPre3x = annotation.since().isEmpty() && !ApiServer.ApiDisallowInternalIds.value();
Review Comment:
With api.disallow.internal.ids enabled (default), non-UUID inputs for UUID parameters currently hit the "!isPre3x && !isUuid" branch and return null. That silently drops the provided parameter (and can broaden list results) instead of returning a PARAM_ERROR, so internal DB IDs (and other invalid formats) are not reliably rejected.
##########
server/src/main/java/com/cloud/api/ApiServer.java:
##########
@@ -348,6 +348,19 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer
, ConfigKey.Scope.Global, null, null, null, null, null, ConfigKey.Kind.Select,
EnumSet.allOf(ApiSessionKeyCheckOption.class).stream().map(Enum::toString).collect(Collectors.joining(", ")));
+ public static final ConfigKey<Boolean> ApiDisallowInternalIds = new ConfigKey<>(
+ ConfigKey.CATEGORY_ADVANCED,
+ Boolean.class,
+ "api.disallow.internal.ids",
+ "true",
+ "When enabled, APIs will not honour requests containing internal database IDs. "
+ + "Only UUIDs will be accepted as entity identifiers. "
+ + "By default, internal IDs are not accepted even for pre-3.x APIs.",
Review Comment:
The new global setting description is a bit ambiguous about the effect of disabling it. Since this is a user-facing config description, it would be clearer to explicitly document the default and what happens when set to false (legacy pre-3.x APIs accepting internal IDs).
##########
server/src/main/java/com/cloud/api/dispatch/ParamProcessWorker.java:
##########
@@ -510,7 +511,7 @@ private Long translateUuidToInternalId(final String uuid, final Parameter annota
}
Long internalId = null;
// If annotation's empty, the cmd existed before 3.x try conversion to long
- final boolean isPre3x = annotation.since().isEmpty();
+ final boolean isPre3x = annotation.since().isEmpty() && !ApiServer.ApiDisallowInternalIds.value();
Review Comment:
This change adds a new config-controlled behavior for UUID parsing, but there are no unit tests covering that internal IDs / non-UUID inputs are rejected when api.disallow.internal.ids is true (the default). Adding a focused ParamProcessWorkerTest case would prevent regressions and confirm the intended behavior from #9684.
--
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