cloudstack
cloudstack copied to clipboard
Quota tariff order
Description
Quota tariffs have been extended to make it possible to define the order of their execution. To achieve this, the position
parameter was added to the quotaTariffCreate
and quotaTariffUpdate
APIs. This parameter is used to define the tariff execution sequence of tariffs with the same usage type. This order is ascending, that is, a tariff with position
equal to 1 will be executed before a tariff with position
equal to 2. If two tariffs of the same usage type have equal positions, the most recent one will be executed first.
During the processing of Quota tariffs, ACS will execute them in the defined order and inject the values into subsequent rates. To enable tariff injection, the preset variable lastTariffs
was created. It will have a list of objects containing the id
and value
attributes of the tariffs executed before it. Below is an example of the variable value when executing 3 tariffs (A
, B
and C
) of the same usage type:
- When executing tariff
A
, the value oflastTariffs
will be:
[ ]
- When executing rule
B
,lastTariffs
will have the value:
[
{
"id": <A_uuid>,
"value": <A_result>
}
]
- When executing rule
C
,lastTariffs
will have the values:
[
{
"id": <A_uuid>,
"value": <A_result>
},
{
"id": <B_uuid>,
"value": <B_result>
}
]
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
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
- [ ] Major
- [X] Minor
How Has This Been Tested?
About the quotaTariffCreate
and quotaTariffUpdate
APIs
Num | Test | Result | Expected result? |
---|---|---|---|
1 | Create a tariff informing the position | Tariff was created with the position informed | Y |
2 | Create a tariff without informing the position | Tariff was created with default position 1 | Y |
3 | Edit a tariff by entering a new position | Tariff was edited with the position given | Y |
4 | Edit a tariff without entering a new position | Tariff was edited maintaining the previous position | Y |
About the lastTariffs
preset variable:
I created three tariffs with activation rules:
- the first with position 1 and always returning 10
- the second with position 2 and the rule:
lastTariffs[0].value + 7
- the third with position 3 and the rule:
lastTariffs[0].value + lastTariffs[1].value
.
When running quotaUpdate
, I looked in the logs for which values were calculated according to the tariffs, the first returned 10, the second 17 and the third 27.
Codecov Report
Attention: Patch coverage is 65.71429%
with 12 lines
in your changes are missing coverage. Please review.
Project coverage is 31.04%. Comparing base (
0e32380
) to head (38b1f00
). Report is 1 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #8347 +/- ##
============================================
+ Coverage 4.34% 31.04% +26.70%
- Complexity 0 33910 +33910
============================================
Files 361 5405 +5044
Lines 29004 380315 +351311
Branches 5092 55505 +50413
============================================
+ Hits 1260 118079 +116819
- Misses 27604 246497 +218893
- Partials 140 15739 +15599
Flag | Coverage Δ | |
---|---|---|
simulator-marvin-tests | 24.61% <0.00%> (?) |
|
uitests | 4.34% <ø> (ø) |
|
unit-tests | 16.88% <65.71%> (?) |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
clgtm and well covered by tests, however as this is user facinng functionality, doe sit make sense to add an integration test @JoaoJandre ?
Sure, I'll try to add some integration tests
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.
@DaanHoogland I've created the integration test. However, while testing it, I found out that the test only works alongside #8581, thus, this PR now depends on #8581.
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.
@blueorangutan package
@JoaoJandre 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.
Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 8651
@blueorangutan test alma9 kvm-alma9
@DaanHoogland a [SL] Trillian-Jenkins test job (alma9 mgmt + kvm-alma9) has been kicked to run smoke tests
[SF] Trillian test result (tid-9227) Environment: kvm-alma9 (x2), Advanced Networking with Mgmt server a9 Total time taken: 55776 seconds Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr8347-t9227-kvm-alma9.zip Smoke tests completed. 124 look OK, 5 have errors, 0 did not run Only failed and skipped tests results shown below:
Test | Result | Time (s) | Test File |
---|---|---|---|
test_01_create_template | Error |
14.60 | test_templates.py |
test_CreateTemplateWithDuplicateName | Error |
21.91 | test_templates.py |
test_02_create_template_with_checksum_sha1 | Error |
65.66 | test_templates.py |
test_03_create_template_with_checksum_sha256 | Error |
65.65 | test_templates.py |
test_04_create_template_with_checksum_md5 | Error |
65.63 | test_templates.py |
test_05_create_template_with_no_checksum | Error |
121.06 | test_templates.py |
test_03_delete_template | Error |
1.09 | test_templates.py |
test_04_extract_template | Error |
1.09 | test_templates.py |
ContextSuite context=TestISOUsage>:setup | Error |
0.00 | test_usage.py |
test_01_volume_usage | Error |
192.84 | test_usage.py |
ContextSuite context=TestVPCRedundancy>:setup | Error |
0.00 | test_vpc_redundant.py |
ContextSuite context=TestVPCNics>:setup | Error |
0.00 | test_vpc_router_nics.py |
ContextSuite context=TestRVPCSite2SiteVpn>:setup | Error |
0.00 | test_vpc_vpn.py |
ContextSuite context=TestVPCSite2SiteVPNMultipleOptions>:setup | Error |
0.00 | test_vpc_vpn.py |
ContextSuite context=TestVpcRemoteAccessVpn>:setup | Error |
0.00 | test_vpc_vpn.py |
ContextSuite context=TestVpcSite2SiteVpn>:setup | Error |
0.00 | test_vpc_vpn.py |
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.
@blueorangutan package
@JoaoJandre 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.
Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 8938
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.
@blueorangutan package
@JoaoJandre 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.
Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 9221
Codecov Report
Attention: Patch coverage is 58.49057%
with 22 lines
in your changes missing coverage. Please review.
Project coverage is 15.53%. Comparing base (
c6d3f6e
) to head (9d31172
).
Additional details and impacted files
@@ Coverage Diff @@
## main #8347 +/- ##
===========================================
Coverage 15.53% 15.53%
- Complexity 11967 11974 +7
===========================================
Files 5492 5493 +1
Lines 480929 480978 +49
Branches 59409 60881 +1472
===========================================
+ Hits 74711 74741 +30
- Misses 397957 397976 +19
Partials 8261 8261
Flag | Coverage Δ | |
---|---|---|
uitests | 4.17% <ø> (ø) |
|
unittests | 16.30% <58.49%> (+<0.01%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.
@blueorangutan package
@JoaoJandre 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.
Packaging result [SF]: ✖️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 9864