Uh oh!
There was an error while loading. Please reload this page.
Add offering preset variables for Network and VPC Quota tariffs - #11810
Conversation
hsato03
commented
Oct 8, 2025
@blueorangutan package |
blueorangutan
commented
Oct 8, 2025
@hsato03 a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@## main #11810 +/- ##
=========================================
Coverage 18.02% 18.03% - Complexity 16460 16473 +13
=========================================
Files 5968 5968 Lines 537213 537248 +35 Branches 65975 65977 +2 =========================================
+ Hits 96825 96884 +59 + Misses 429469 429445 -24
Partials 10919 10919
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
commented
Oct 8, 2025
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 15349 |
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
DaanHoogland
commented
Jan 19, 2026
@blueorangutan package |
blueorangutan
commented
Jan 19, 2026
@DaanHoogland 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
commented
Jan 19, 2026
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 16429 |
DaanHoogland
commented
Jan 19, 2026
@blueorangutan test keepEnv |
blueorangutan
commented
Jan 19, 2026
@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
blueorangutan
commented
Jan 20, 2026
[SF] Trillian test result (tid-15218)
|
There was a problem hiding this comment.
Pull request overview
This PR adds offering preset variables for Network and VPC quota tariffs, enabling users to create activation rules based on the network offering and VPC offering properties.
Changes:
- Added
networkOfferingandvpcOfferingpreset variables to theValueclass with appropriate getters/setters - Implemented helper methods to retrieve network and VPC offering information
- Relocated VPC offering DAO beans to the common Spring context for usage module access
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| PresetVariableHelper.java | Added getPresetVariableValueNetworkOffering and getPresetVariableValueVpcOffering methods to populate offering information; updated load methods to set the new fields |
| Value.java | Added networkOffering and vpcOffering fields with @PresetVariableDefinition annotations and corresponding getters/setters |
| PresetVariableHelperTest.java | Added unit tests for the new getPresetVariableValueNetworkOffering and getPresetVariableValueVpcOffering methods; added VpcOfferingDao mock |
| spring-engine-schema-core-daos-context.xml | Removed vpcOfferingDaoImpl and vpcOfferingDetailsDaoImpl bean definitions |
| spring-engine-schema-core-common-daos-between-management-and-usage-context.xml | Added vpcOfferingDaoImpl and vpcOfferingDetailsDaoImpl bean definitions to make them accessible in the usage context |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
DaanHoogland
commented
Jan 21, 2026
@hsato03 , I feel a bit out of my depth on these preset variables and they only appear once in the documentation when it comes to storage; i.e. https://docs.cloudstack.apache.org/en/4.22.0.0/adminguide/storage.html#direct-resources-to-a-specific-secondary-storage. Is there some wiki page I can read to be able to concoct sensible tests for this? @winterhazel , will you review? |
winterhazel
commented
Jan 21, 2026
@DaanHoogland yes, I should be able to review and test this one by the end of the week.
The Quota documentation needs some updating on how to use the activation rules and preset variables. There is no wiki on how to use them at the moment. We hope to address it in version 23/24 along with the pending code changes. Here's a basic guide on how to test the changes in this PR:
After the Usage job finishes generating all usage records, Quota will process them and charge credits from users based on the tariffs. You can follow Usage's logs during the job's execution to see which values are being charged for that execution, debug it to see which values are being injected as preset variables (I usually place my breakpoint in org.apache.cloudstack.quota.QuotaManagerImpl#injectPresetVariablesIntoJsInterpreter), and see the new balances in the Quota summary page. The idea for debugging other PRs that add preset variables is the same. |
winterhazel
commented
Jan 25, 2026
While testing this, I found that preset variables are not being injected correctly into the JS interpreter anymore, which prevents this change from working as expected. #12515 needs to be merged first. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Fabricio Duarte <fabricio.duarte.jr@gmail.com>
hsato03
commented
Mar 30, 2026
@blueorangutan package |
blueorangutan
commented
Mar 30, 2026
@hsato03 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
commented
Mar 30, 2026
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 17293 |
winterhazel
commented
Apr 13, 2026
@DaanHoogland can we run the CI here? |
bernardodemarco
left a comment
There was a problem hiding this comment.
code lgtm, did not test it
DaanHoogland
commented
Apr 14, 2026
@blueorangutan test |
blueorangutan
commented
Apr 14, 2026
@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
blueorangutan
commented
Apr 14, 2026
[SF] Trillian test result (tid-15867)
|
winterhazel
left a comment
There was a problem hiding this comment.
Looks good. I tested by following the steps in #11810 (comment) and validating that the network and VPC tariffs were applying the correct values depending on the resource's offering.
Uh oh!
There was an error while loading. Please reload this page.
Description
This PR adds two new preset variables for
NetworkandVPCusage type Quota tariffs.For
Networktariffs, the variablesvalue.networkOffering.idandvalue.networkOffering.namehave been created. ForVPCtariffs, the variablesvalue.vpcOffering.idandvalue.vpcOffering.namehave been added.They represent the resource's offering ID and name, respectively.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
I created an isolated network and a VPC with the following offerings.
Then, I created a
Networktariff (offering-test-network) with the following activation rule.Next, I created a
VPCtariff (offering-test-vpc) with the following activation rule.I called the
quotaUpdateAPI and verified that the value 300 was returned by theoffering-test-networkactivation rule, whileoffering-test-vpcreturned 500.How did you try to break this feature and the system with this change?