You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by "JoaoJandre (via GitHub)" <gi...@apache.org> on 2023/12/12 11:39:23 UTC

[PR] quota tariff positions [cloudstack]

JoaoJandre opened a new pull request, #8347:
URL: https://github.com/apache/cloudstack/pull/8347

   ### 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 of `lastTariffs` 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]+7`
    - the third with position 3 and the rule: `lastTariffs[0] + lastTariffs[1]`. 
    
    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.


-- 
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] Quota tariff order [cloudstack]

Posted by "JoaoJandre (via GitHub)" <gi...@apache.org>.
JoaoJandre commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-2161151487

   @DaanHoogland @sureshanaparti @rohityadavcloud could we run the CI here?


-- 
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] Quota tariff order [cloudstack]

Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-2227071761

   @blueorangutan test alma9 kvm-alma9


-- 
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] Quota tariff order [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-2048213044

   @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.


-- 
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] Quota tariff order [cloudstack]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-1952018376

   This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.


-- 
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] Quota tariff order [cloudstack]

Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-2225039033

   @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] Quota tariff order [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-2222626706

   @DaanHoogland a [SL] Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) 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] Quota tariff order [cloudstack]

Posted by "JoaoJandre (via GitHub)" <gi...@apache.org>.
JoaoJandre commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-1927391479

   @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 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] Quota tariff order [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-1997393608

   @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.


-- 
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] Quota tariff order [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-1997540299

   Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 8938


-- 
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] Quota tariff order [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-2224347613

   <b>[SF] Trillian test result (tid-10803)</b>
   Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
   Total time taken: 57235 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr8347-t10803-kvm-centos7.zip
   Smoke tests completed. 113 look OK, 24 have errors, 0 did not run
   Only failed and skipped tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   test_role_account_acls_multiple_mgmt_servers | `Error` | 2.36 | test_dynamicroles.py
   test_query_async_job_result | `Error` | 96.84 | test_async_job.py
   test_revoke_certificate | `Error` | 0.02 | test_certauthority_root.py
   test_configure_ha_provider_invalid | `Error` | 0.01 | test_hostha_simulator.py
   test_configure_ha_provider_valid | `Error` | 0.01 | test_hostha_simulator.py
   test_ha_configure_enabledisable_across_clusterzones | `Error` | 0.01 | test_hostha_simulator.py
   test_ha_disable_feature_invalid | `Error` | 0.01 | test_hostha_simulator.py
   test_ha_enable_feature_invalid | `Error` | 0.01 | test_hostha_simulator.py
   test_ha_list_providers | `Error` | 0.01 | test_hostha_simulator.py
   test_ha_multiple_mgmt_server_ownership | `Error` | 0.01 | test_hostha_simulator.py
   test_ha_verify_fsm_available | `Error` | 0.01 | test_hostha_simulator.py
   test_ha_verify_fsm_degraded | `Error` | 0.01 | test_hostha_simulator.py
   test_ha_verify_fsm_fenced | `Error` | 0.01 | test_hostha_simulator.py
   test_ha_verify_fsm_recovering | `Error` | 0.01 | test_hostha_simulator.py
   test_hostha_configure_default_driver | `Error` | 0.01 | test_hostha_simulator.py
   test_hostha_configure_invalid_provider | `Error` | 0.01 | test_hostha_simulator.py
   test_hostha_disable_feature_valid | `Error` | 0.01 | test_hostha_simulator.py
   test_hostha_enable_feature_valid | `Error` | 0.01 | test_hostha_simulator.py
   test_hostha_enable_feature_without_setting_provider | `Error` | 0.01 | test_hostha_simulator.py
   test_list_ha_for_host | `Error` | 0.01 | test_hostha_simulator.py
   test_list_ha_for_host_invalid | `Error` | 0.01 | test_hostha_simulator.py
   test_list_ha_for_host_valid | `Error` | 0.01 | test_hostha_simulator.py
   test_01_host_ping_on_alert | `Error` | 0.07 | test_host_ping.py
   test_01_host_ping_on_alert | `Error` | 0.07 | test_host_ping.py
   test_01_browser_migrate_template | `Error` | 15.36 | test_image_store_object_migration.py
   test_01_invalid_upgrade_kubernetes_cluster | `Failure` | 245.78 | test_kubernetes_clusters.py
   test_02_upgrade_kubernetes_cluster | `Failure` | 250.66 | test_kubernetes_clusters.py
   test_03_deploy_and_scale_kubernetes_cluster | `Failure` | 227.13 | test_kubernetes_clusters.py
   test_04_autoscale_kubernetes_cluster | `Failure` | 236.31 | test_kubernetes_clusters.py
   test_05_basic_lifecycle_kubernetes_cluster | `Failure` | 236.63 | test_kubernetes_clusters.py
   test_06_delete_kubernetes_cluster | `Failure` | 233.50 | test_kubernetes_clusters.py
   test_08_upgrade_kubernetes_ha_cluster | `Failure` | 336.10 | test_kubernetes_clusters.py
   test_10_vpc_tier_kubernetes_cluster | `Failure` | 259.87 | test_kubernetes_clusters.py
   test_11_test_unmanaged_cluster_lifecycle | `Error` | 83.87 | test_kubernetes_clusters.py
   test_01_add_delete_kubernetes_supported_version | `Error` | 0.11 | test_kubernetes_supported_versions.py
   login_test_saml_user | `Error` | 2.99 | test_login.py
   test_01_deployVMInSharedNetwork | `Error` | 75.27 | test_network.py
   test_03_destroySharedNetwork | `Failure` | 1.08 | test_network.py
   ContextSuite context=TestSharedNetwork>:teardown | `Error` | 2.19 | test_network.py
   test_oobm_issue_power_cycle | `Error` | 3.30 | test_outofbandmanagement_nestedplugin.py
   test_oobm_issue_power_off | `Error` | 3.29 | test_outofbandmanagement_nestedplugin.py
   test_oobm_issue_power_on | `Error` | 3.29 | test_outofbandmanagement_nestedplugin.py
   test_oobm_issue_power_reset | `Error` | 3.31 | test_outofbandmanagement_nestedplugin.py
   test_oobm_issue_power_soft | `Error` | 3.32 | test_outofbandmanagement_nestedplugin.py
   test_oobm_issue_power_status | `Error` | 2.22 | test_outofbandmanagement_nestedplugin.py
   test_oobm_background_powerstate_sync | `Failure` | 21.69 | test_outofbandmanagement.py
   test_oobm_background_powerstate_sync | `Error` | 21.69 | test_outofbandmanagement.py
   test_oobm_configure_default_driver | `Error` | 0.05 | test_outofbandmanagement.py
   test_oobm_configure_invalid_driver | `Error` | 0.05 | test_outofbandmanagement.py
   test_oobm_disable_feature_invalid | `Error` | 0.04 | test_outofbandmanagement.py
   test_oobm_disable_feature_valid | `Error` | 1.14 | test_outofbandmanagement.py
   test_oobm_enable_feature_invalid | `Error` | 0.05 | test_outofbandmanagement.py
   test_oobm_enable_feature_valid | `Error` | 1.13 | test_outofbandmanagement.py
   test_oobm_enabledisable_across_clusterzones | `Error` | 9.84 | test_outofbandmanagement.py
   test_oobm_enabledisable_across_clusterzones | `Error` | 9.84 | test_outofbandmanagement.py
   test_oobm_issue_power_cycle | `Error` | 4.32 | test_outofbandmanagement.py
   test_oobm_issue_power_cycle | `Error` | 4.32 | test_outofbandmanagement.py
   test_oobm_issue_power_off | `Error` | 4.34 | test_outofbandmanagement.py
   test_oobm_issue_power_off | `Error` | 4.34 | test_outofbandmanagement.py
   test_oobm_issue_power_on | `Error` | 4.34 | test_outofbandmanagement.py
   test_oobm_issue_power_on | `Error` | 4.34 | test_outofbandmanagement.py
   test_oobm_issue_power_reset | `Error` | 4.32 | test_outofbandmanagement.py
   test_oobm_issue_power_reset | `Error` | 4.32 | test_outofbandmanagement.py
   test_oobm_issue_power_soft | `Error` | 3.31 | test_outofbandmanagement.py
   test_oobm_issue_power_soft | `Error` | 3.31 | test_outofbandmanagement.py
   test_oobm_issue_power_status | `Error` | 4.32 | test_outofbandmanagement.py
   test_oobm_issue_power_status | `Error` | 4.32 | test_outofbandmanagement.py
   test_oobm_multiple_mgmt_server_ownership | `Error` | 1.14 | test_outofbandmanagement.py
   test_oobm_multiple_mgmt_server_ownership | `Error` | 1.14 | test_outofbandmanagement.py
   test_oobm_zchange_password | `Error` | 2.25 | test_outofbandmanagement.py
   test_oobm_zchange_password | `Error` | 2.25 | test_outofbandmanagement.py
   test_02_edit_primary_storage_tags | `Error` | 0.01 | test_primary_storage.py
   test_01_primary_storage_scope_change | `Error` | 0.11 | test_primary_storage_scope.py
   test_01_vpc_privategw_acl | `Error` | 0.03 | test_privategw_acl_ovs_gre.py
   test_03_vpc_privategw_restart_vpc_cleanup | `Error` | 0.02 | test_privategw_acl_ovs_gre.py
   test_05_vpc_privategw_check_interface | `Error` | 0.02 | test_privategw_acl_ovs_gre.py
   test_01_vpc_privategw_acl | `Error` | 55.77 | test_privategw_acl.py
   test_02_vpc_privategw_static_routes | `Error` | 205.95 | test_privategw_acl.py
   test_03_vpc_privategw_restart_vpc_cleanup | `Error` | 212.06 | test_privategw_acl.py
   test_04_rvpc_privategw_static_routes | `Error` | 325.38 | test_privategw_acl.py
   test_01_purge_expunged_api_vm_start_date | `Error` | 47.58 | test_purge_expunged_vms.py
   test_02_purge_expunged_api_vm_end_date | `Error` | 45.05 | test_purge_expunged_vms.py
   test_03_purge_expunged_api_vm_start_end_date | `Error` | 43.01 | test_purge_expunged_vms.py
   test_04_purge_expunged_api_vm_no_date | `Error` | 44.84 | test_purge_expunged_vms.py
   test_05_purge_expunged_vm_service_offering | `Error` | 267.07 | test_purge_expunged_vms.py
   test_06_purge_expunged_vm_background_task | `Error` | 330.79 | test_purge_expunged_vms.py
   test_01_snapshot_root_disk | `Error` | 4.30 | test_snapshots.py
   test_CreateTemplateWithDuplicateName | `Error` | 23.88 | test_templates.py
   test_01_register_template_direct_download_flag | `Error` | 0.16 | test_templates.py
   test_01_positive_tests_usage | `Error` | 9.36 | test_usage_events.py
   test_01_ISO_usage | `Error` | 1.09 | test_usage.py
   test_01_lb_usage | `Error` | 4.24 | test_usage.py
   test_01_nat_usage | `Error` | 8.35 | test_usage.py
   test_01_public_ip_usage | `Error` | 1.08 | test_usage.py
   test_01_snapshot_usage | `Error` | 38.30 | test_usage.py
   test_01_template_usage | `Error` | 9.40 | test_usage.py
   test_01_vm_usage | `Error` | 132.94 | test_usage.py
   test_01_volume_usage | `Error` | 125.96 | test_usage.py
   test_01_vpn_usage | `Error` | 9.52 | test_usage.py
   test_12_start_vm_multiple_volumes_allocated | `Error` | 10.56 | test_vm_life_cycle.py
   test_01_vmschedule_create | `Error` | 0.09 | test_vm_schedule.py
   test_disable_oobm_ha_state_ineligible | `Error` | 0.06 | test_hostha_kvm.py
   test_hostha_configure_default_driver | `Error` | 0.05 | test_hostha_kvm.py
   test_hostha_enable_ha_when_host_disabled | `Error` | 0.05 | test_hostha_kvm.py
   test_hostha_enable_ha_when_host_disconected | `Error` | 0.04 | test_hostha_kvm.py
   test_hostha_enable_ha_when_host_in_maintenance | `Error` | 0.04 | test_hostha_kvm.py
   test_hostha_kvm_host_degraded | `Error` | 0.04 | test_hostha_kvm.py
   test_hostha_kvm_host_fencing | `Error` | 0.04 | test_hostha_kvm.py
   test_hostha_kvm_host_recovering | `Error` | 0.05 | test_hostha_kvm.py
   test_remove_ha_provider_not_possible | `Error` | 0.05 | test_hostha_kvm.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] Quota tariff order [cloudstack]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-1851882763

   ## [Codecov](https://app.codecov.io/gh/apache/cloudstack/pull/8347?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   All modified and coverable lines are covered by tests :white_check_mark:
   > Comparison is base [(`a15b706`)](https://app.codecov.io/gh/apache/cloudstack/commit/a15b706fbe7809b58a687c690f71391e0bed4117?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) 22.25% compared to head [(`aecfb2f`)](https://app.codecov.io/gh/apache/cloudstack/pull/8347?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) 4.42%.
   > Report is 31 commits behind head on main.
   
   
   <details><summary>Additional details and impacted files</summary>
   
   
   ```diff
   @@             Coverage Diff              @@
   ##               main   #8347       +/-   ##
   ============================================
   - Coverage     22.25%   4.42%   -17.83%     
   ============================================
     Files          5117     361     -4756     
     Lines        346819   28411   -318408     
     Branches      49790    4958    -44832     
   ============================================
   - Hits          77190    1258    -75932     
   + Misses       258466   27015   -231451     
   + Partials      11163     138    -11025     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/cloudstack/pull/8347/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [simulator-marvin-tests](https://app.codecov.io/gh/apache/cloudstack/pull/8347/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [uitests](https://app.codecov.io/gh/apache/cloudstack/pull/8347/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `4.42% <ø> (-0.03%)` | :arrow_down: |
   
   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/8347?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).
   


-- 
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] Quota tariff order [cloudstack]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-1859726118

   This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.


-- 
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] Quota tariff order [cloudstack]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-1934110426

   This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.


-- 
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] Quota tariff order [cloudstack]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-2139729457

   This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.


-- 
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] Quota tariff order [cloudstack]

Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-2225038891

   > [SF] Trillian test result (tid-10803) Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7 Total time taken: 57235 seconds Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr8347-t10803-kvm-centos7.zip Smoke tests completed. 113 look OK, 24 have errors, 0 did not run Only failed and skipped tests results shown below:
   > Test 	Result 	Time (s) 	Test File
   
   ...
   
   I'm guessing these are flukes, apllyining well tested insanity method


-- 
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] Quota tariff order [cloudstack]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-1882870995

   This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.


-- 
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] Quota tariff order [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-2225040894

   @DaanHoogland a [SL] Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) 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] Quota tariff order [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-2226730936

   <b>[SF] Trillian test result (tid-10811)</b>
   Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
   Total time taken: 65827 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr8347-t10811-kvm-centos7.zip
   Smoke tests completed. 110 look OK, 27 have errors, 0 did not run
   Only failed and skipped tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   test_role_account_acls_multiple_mgmt_servers | `Error` | 2.25 | test_dynamicroles.py
   test_query_async_job_result | `Error` | 102.06 | test_async_job.py
   test_revoke_certificate | `Error` | 0.01 | test_certauthority_root.py
   test_configure_ha_provider_invalid | `Error` | 0.02 | test_hostha_simulator.py
   test_configure_ha_provider_valid | `Error` | 0.01 | test_hostha_simulator.py
   test_ha_configure_enabledisable_across_clusterzones | `Error` | 0.01 | test_hostha_simulator.py
   test_ha_disable_feature_invalid | `Error` | 0.01 | test_hostha_simulator.py
   test_ha_enable_feature_invalid | `Error` | 0.01 | test_hostha_simulator.py
   test_ha_list_providers | `Error` | 0.01 | test_hostha_simulator.py
   test_ha_multiple_mgmt_server_ownership | `Error` | 0.01 | test_hostha_simulator.py
   test_ha_verify_fsm_available | `Error` | 0.01 | test_hostha_simulator.py
   test_ha_verify_fsm_degraded | `Error` | 0.01 | test_hostha_simulator.py
   test_ha_verify_fsm_fenced | `Error` | 0.01 | test_hostha_simulator.py
   test_ha_verify_fsm_recovering | `Error` | 0.01 | test_hostha_simulator.py
   test_hostha_configure_default_driver | `Error` | 0.01 | test_hostha_simulator.py
   test_hostha_configure_invalid_provider | `Error` | 0.01 | test_hostha_simulator.py
   test_hostha_disable_feature_valid | `Error` | 0.01 | test_hostha_simulator.py
   test_hostha_enable_feature_valid | `Error` | 0.01 | test_hostha_simulator.py
   test_hostha_enable_feature_without_setting_provider | `Error` | 0.01 | test_hostha_simulator.py
   test_list_ha_for_host | `Error` | 0.01 | test_hostha_simulator.py
   test_list_ha_for_host_invalid | `Error` | 0.01 | test_hostha_simulator.py
   test_list_ha_for_host_valid | `Error` | 0.01 | test_hostha_simulator.py
   test_01_host_ping_on_alert | `Error` | 0.07 | test_host_ping.py
   test_01_host_ping_on_alert | `Error` | 0.07 | test_host_ping.py
   test_01_browser_migrate_template | `Error` | 15.35 | test_image_store_object_migration.py
   test_01_invalid_upgrade_kubernetes_cluster | `Failure` | 261.55 | test_kubernetes_clusters.py
   test_02_upgrade_kubernetes_cluster | `Failure` | 234.03 | test_kubernetes_clusters.py
   test_03_deploy_and_scale_kubernetes_cluster | `Failure` | 232.03 | test_kubernetes_clusters.py
   test_04_autoscale_kubernetes_cluster | `Failure` | 223.40 | test_kubernetes_clusters.py
   test_05_basic_lifecycle_kubernetes_cluster | `Failure` | 228.62 | test_kubernetes_clusters.py
   test_06_delete_kubernetes_cluster | `Failure` | 227.60 | test_kubernetes_clusters.py
   test_08_upgrade_kubernetes_ha_cluster | `Failure` | 344.10 | test_kubernetes_clusters.py
   test_10_vpc_tier_kubernetes_cluster | `Failure` | 237.35 | test_kubernetes_clusters.py
   test_11_test_unmanaged_cluster_lifecycle | `Error` | 88.01 | test_kubernetes_clusters.py
   test_01_add_delete_kubernetes_supported_version | `Error` | 0.12 | test_kubernetes_supported_versions.py
   login_test_saml_user | `Error` | 2.92 | test_login.py
   test_01_deployVMInSharedNetwork | `Error` | 75.28 | test_network.py
   test_03_destroySharedNetwork | `Failure` | 1.09 | test_network.py
   ContextSuite context=TestSharedNetwork>:teardown | `Error` | 2.18 | test_network.py
   test_oobm_issue_power_cycle | `Error` | 3.30 | test_outofbandmanagement_nestedplugin.py
   test_oobm_issue_power_off | `Error` | 3.29 | test_outofbandmanagement_nestedplugin.py
   test_oobm_issue_power_on | `Error` | 3.30 | test_outofbandmanagement_nestedplugin.py
   test_oobm_issue_power_reset | `Error` | 3.30 | test_outofbandmanagement_nestedplugin.py
   test_oobm_issue_power_soft | `Error` | 3.29 | test_outofbandmanagement_nestedplugin.py
   test_oobm_issue_power_status | `Error` | 2.22 | test_outofbandmanagement_nestedplugin.py
   test_oobm_background_powerstate_sync | `Failure` | 21.65 | test_outofbandmanagement.py
   test_oobm_background_powerstate_sync | `Error` | 21.65 | test_outofbandmanagement.py
   test_oobm_configure_default_driver | `Error` | 0.06 | test_outofbandmanagement.py
   test_oobm_configure_invalid_driver | `Error` | 0.05 | test_outofbandmanagement.py
   test_oobm_disable_feature_invalid | `Error` | 0.04 | test_outofbandmanagement.py
   test_oobm_disable_feature_valid | `Error` | 1.13 | test_outofbandmanagement.py
   test_oobm_enable_feature_invalid | `Error` | 0.04 | test_outofbandmanagement.py
   test_oobm_enable_feature_valid | `Error` | 1.12 | test_outofbandmanagement.py
   test_oobm_enabledisable_across_clusterzones | `Error` | 11.83 | test_outofbandmanagement.py
   test_oobm_enabledisable_across_clusterzones | `Error` | 11.83 | test_outofbandmanagement.py
   test_oobm_issue_power_cycle | `Error` | 4.34 | test_outofbandmanagement.py
   test_oobm_issue_power_cycle | `Error` | 4.34 | test_outofbandmanagement.py
   test_oobm_issue_power_off | `Error` | 4.30 | test_outofbandmanagement.py
   test_oobm_issue_power_off | `Error` | 4.30 | test_outofbandmanagement.py
   test_oobm_issue_power_on | `Error` | 3.30 | test_outofbandmanagement.py
   test_oobm_issue_power_on | `Error` | 3.30 | test_outofbandmanagement.py
   test_oobm_issue_power_reset | `Error` | 4.34 | test_outofbandmanagement.py
   test_oobm_issue_power_reset | `Error` | 4.34 | test_outofbandmanagement.py
   test_oobm_issue_power_soft | `Error` | 4.33 | test_outofbandmanagement.py
   test_oobm_issue_power_soft | `Error` | 4.34 | test_outofbandmanagement.py
   test_oobm_issue_power_status | `Error` | 3.32 | test_outofbandmanagement.py
   test_oobm_issue_power_status | `Error` | 3.32 | test_outofbandmanagement.py
   test_oobm_multiple_mgmt_server_ownership | `Error` | 1.15 | test_outofbandmanagement.py
   test_oobm_multiple_mgmt_server_ownership | `Error` | 1.15 | test_outofbandmanagement.py
   test_oobm_zchange_password | `Error` | 2.20 | test_outofbandmanagement.py
   test_oobm_zchange_password | `Error` | 2.20 | test_outofbandmanagement.py
   test_02_edit_primary_storage_tags | `Error` | 0.02 | test_primary_storage.py
   test_01_primary_storage_scope_change | `Error` | 0.08 | test_primary_storage_scope.py
   test_01_vpc_privategw_acl | `Error` | 0.03 | test_privategw_acl_ovs_gre.py
   test_03_vpc_privategw_restart_vpc_cleanup | `Error` | 0.02 | test_privategw_acl_ovs_gre.py
   test_05_vpc_privategw_check_interface | `Error` | 0.02 | test_privategw_acl_ovs_gre.py
   test_01_vpc_privategw_acl | `Error` | 53.80 | test_privategw_acl.py
   test_02_vpc_privategw_static_routes | `Error` | 199.94 | test_privategw_acl.py
   test_03_vpc_privategw_restart_vpc_cleanup | `Error` | 200.88 | test_privategw_acl.py
   test_04_rvpc_privategw_static_routes | `Error` | 320.67 | test_privategw_acl.py
   test_01_purge_expunged_api_vm_start_date | `Error` | 51.09 | test_purge_expunged_vms.py
   test_02_purge_expunged_api_vm_end_date | `Error` | 47.38 | test_purge_expunged_vms.py
   test_03_purge_expunged_api_vm_start_end_date | `Error` | 45.27 | test_purge_expunged_vms.py
   test_04_purge_expunged_api_vm_no_date | `Error` | 43.13 | test_purge_expunged_vms.py
   test_05_purge_expunged_vm_service_offering | `Error` | 271.11 | test_purge_expunged_vms.py
   test_06_purge_expunged_vm_background_task | `Error` | 329.61 | test_purge_expunged_vms.py
   test_01_snapshot_root_disk | `Error` | 5.34 | test_snapshots.py
   test_CreateTemplateWithDuplicateName | `Error` | 20.75 | test_templates.py
   test_01_register_template_direct_download_flag | `Error` | 0.18 | test_templates.py
   test_01_positive_tests_usage | `Error` | 10.46 | test_usage_events.py
   test_01_ISO_usage | `Error` | 1.09 | test_usage.py
   test_01_lb_usage | `Error` | 4.25 | test_usage.py
   test_01_nat_usage | `Error` | 8.34 | test_usage.py
   test_01_public_ip_usage | `Error` | 1.07 | test_usage.py
   test_01_snapshot_usage | `Error` | 22.68 | test_usage.py
   test_01_template_usage | `Error` | 13.50 | test_usage.py
   test_01_vm_usage | `Error` | 136.46 | test_usage.py
   test_01_volume_usage | `Error` | 128.17 | test_usage.py
   test_01_vpn_usage | `Error` | 8.48 | test_usage.py
   test_03_secured_to_nonsecured_vm_migration | `Error` | 425.71 | test_vm_life_cycle.py
   test_10_attachAndDetach_iso | `Failure` | 612.51 | test_vm_life_cycle.py
   test_12_start_vm_multiple_volumes_allocated | `Error` | 12.65 | test_vm_life_cycle.py
   test_01_vmschedule_create | `Error` | 0.12 | test_vm_schedule.py
   test_01_verify_ipv6_vpc | `Error` | 611.24 | test_vpc_ipv6.py
   test_01_create_redundant_VPC_2tiers_4VMs_4IPs_4PF_ACL | `Failure` | 618.17 | test_vpc_redundant.py
   test_02_redundant_VPC_default_routes | `Failure` | 1018.54 | test_vpc_redundant.py
   test_03_create_redundant_VPC_1tier_2VMs_2IPs_2PF_ACL_reboot_routers | `Failure` | 469.89 | test_vpc_redundant.py
   test_05_rvpc_multi_tiers | `Failure` | 578.74 | test_vpc_redundant.py
   test_05_rvpc_multi_tiers | `Error` | 578.75 | test_vpc_redundant.py
   test_02_cancel_host_maintenace_with_migration_jobs | `Error` | 267.73 | test_host_maintenance.py
   test_disable_oobm_ha_state_ineligible | `Error` | 0.06 | test_hostha_kvm.py
   test_hostha_configure_default_driver | `Error` | 0.05 | test_hostha_kvm.py
   test_hostha_enable_ha_when_host_disabled | `Error` | 0.05 | test_hostha_kvm.py
   test_hostha_enable_ha_when_host_disconected | `Error` | 0.05 | test_hostha_kvm.py
   test_hostha_enable_ha_when_host_in_maintenance | `Error` | 0.04 | test_hostha_kvm.py
   test_hostha_kvm_host_degraded | `Error` | 0.04 | test_hostha_kvm.py
   test_hostha_kvm_host_fencing | `Error` | 0.04 | test_hostha_kvm.py
   test_hostha_kvm_host_recovering | `Error` | 0.04 | test_hostha_kvm.py
   test_remove_ha_provider_not_possible | `Error` | 0.04 | test_hostha_kvm.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] Quota tariff order [cloudstack]

Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-2162596488

   @JoaoJandre we are prioritising 4.19 now. /me postponing this.


-- 
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] Quota tariff order [cloudstack]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-2166673372

   This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.


-- 
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] Quota tariff order [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-1947575461

   <b>[SF] Trillian test result (tid-9227)</b>
   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 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] Quota tariff order [cloudstack]

Posted by "BryanMLima (via GitHub)" <gi...@apache.org>.
BryanMLima commented on code in PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#discussion_r1561536028


##########
engine/schema/src/main/resources/META-INF/db/schema-41900to42000.sql:
##########
@@ -79,3 +79,7 @@ CREATE TABLE IF NOT EXISTS `cloud_usage`.`quota_email_configuration`(
     PRIMARY KEY (`account_id`, `email_template_id`),
     CONSTRAINT `FK_quota_email_configuration_account_id` FOREIGN KEY (`account_id`) REFERENCES `cloud_usage`.`quota_account`(`account_id`),
     CONSTRAINT `FK_quota_email_configuration_email_template_id` FOREIGN KEY (`email_template_id`) REFERENCES `cloud_usage`.`quota_email_templates`(`id`));
+
+
+-- Quota inject tariff result into subsequent ones
+ALTER TABLE `cloud_usage`.`quota_tariff` ADD COLUMN `position` bigint(20) NOT NULL DEFAULT 1 COMMENT 'Position in the execution sequence for tariffs of the same type' ;

Review Comment:
   Could use the procedure `IDEMPOTENT_ADD_COLUMN` here.



-- 
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] Quota tariff order [cloudstack]

Posted by "JoaoJandre (via GitHub)" <gi...@apache.org>.
JoaoJandre commented on code in PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#discussion_r1562910276


##########
framework/quota/src/main/java/org/apache/cloudstack/quota/QuotaManagerImpl.java:
##########
@@ -367,9 +369,22 @@ protected BigDecimal aggregateQuotaTariffsValues(UsageVO usageRecord, List<Quota
         PresetVariables presetVariables = getPresetVariables(hasAnyQuotaTariffWithActivationRule, usageRecord);
         BigDecimal aggregatedQuotaTariffsValue = BigDecimal.ZERO;
 
+        quotaTariffs.sort(Comparator.comparing(QuotaTariffVO::getPosition));
+
+        List<Tariff> lastTariffs = new ArrayList<>();
+
+
         for (QuotaTariffVO quotaTariff : quotaTariffs) {
             if (isQuotaTariffInPeriodToBeApplied(usageRecord, quotaTariff, accountToString)) {
-                aggregatedQuotaTariffsValue = aggregatedQuotaTariffsValue.add(getQuotaTariffValueToBeApplied(quotaTariff, jsInterpreter, presetVariables));
+
+                BigDecimal tariffValue = getQuotaTariffValueToBeApplied(quotaTariff, jsInterpreter, presetVariables, lastTariffs);
+
+                aggregatedQuotaTariffsValue = aggregatedQuotaTariffsValue.add(tariffValue);
+
+                Tariff tariffPresetVariable = new Tariff();
+                tariffPresetVariable.setId(quotaTariff.getUuid());
+                tariffPresetVariable.setValue(tariffValue);
+                lastTariffs.add(tariffPresetVariable);

Review Comment:
   Yes, the `tariffPresetVariable` holds the value of the tariff being processed now, and it is added to the `lastTariffs` list, so that it can be processed in a future activation rule.



-- 
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] Quota tariff order [cloudstack]

Posted by "JoaoJandre (via GitHub)" <gi...@apache.org>.
JoaoJandre commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-1853718711

   > 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 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] Quota tariff order [cloudstack]

Posted by "JoaoJandre (via GitHub)" <gi...@apache.org>.
JoaoJandre commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-2160510386

   @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] Quota tariff order [cloudstack]

Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-2222624322

   @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] Quota tariff order [cloudstack]

Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on code in PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#discussion_r1526466247


##########
test/integration/plugins/test_quota_tariff_order.py:
##########
@@ -0,0 +1,185 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+""" Test cases for checking quota API
+"""
+
+# Import Local Modules
+import tools.marvin.marvin
+from tools.marvin.marvin.cloudstackTestCase import *
+from tools.marvin.marvin.cloudstackAPI import *
+from tools.marvin.marvin.lib.utils import *
+from tools.marvin.marvin.lib.base import *
+from tools.marvin.marvin.lib.common import *
+from nose.plugins.attrib import attr
+
+# Import System modules
+import time
+
+
+class TestQuotaTariffOrder(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        testClient = super(TestQuotaTariffOrder, cls).getClsTestClient()
+        cls.api_client = testClient.getApiClient()
+        cls.services = testClient.getParsedTestDataConfig()
+
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client)
+        cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+
+        # Create Account
+        cls.account = Account.create(
+            cls.api_client,
+            cls.services["account"],
+            domainid=cls.domain.id
+        )
+        cls._cleanup = [
+            cls.account,
+        ]
+
+        cls.services["account"] = cls.account.name
+
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            # Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return

Review Comment:
   ```suggestion
       @classmethod
       def tearDownClass(cls):
           super(TestQuotaTariffOrder, cls).tearDownClass()
   ```



##########
test/integration/plugins/test_quota_tariff_order.py:
##########
@@ -0,0 +1,185 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+""" Test cases for checking quota API
+"""
+
+# Import Local Modules
+import tools.marvin.marvin
+from tools.marvin.marvin.cloudstackTestCase import *
+from tools.marvin.marvin.cloudstackAPI import *
+from tools.marvin.marvin.lib.utils import *
+from tools.marvin.marvin.lib.base import *
+from tools.marvin.marvin.lib.common import *
+from nose.plugins.attrib import attr
+
+# Import System modules
+import time
+
+
+class TestQuotaTariffOrder(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        testClient = super(TestQuotaTariffOrder, cls).getClsTestClient()
+        cls.api_client = testClient.getApiClient()
+        cls.services = testClient.getParsedTestDataConfig()
+
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client)
+        cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+
+        # Create Account
+        cls.account = Account.create(
+            cls.api_client,
+            cls.services["account"],
+            domainid=cls.domain.id
+        )
+        cls._cleanup = [
+            cls.account,
+        ]
+
+        cls.services["account"] = cls.account.name
+
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            # Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        self.tariffs = []
+        return
+
+    def tearDown(self):
+        try:
+            cleanup_resources(self.api_client, self.cleanup)
+            self.delete_tariffs()
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return

Review Comment:
   ```suggestion
       def tearDown(self):
           super(TestQuotaTariffOrder, self).tearDown()
   ```



##########
test/integration/plugins/test_quota_tariff_order.py:
##########
@@ -0,0 +1,185 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+""" Test cases for checking quota API
+"""
+
+# Import Local Modules
+import tools.marvin.marvin
+from tools.marvin.marvin.cloudstackTestCase import *
+from tools.marvin.marvin.cloudstackAPI import *
+from tools.marvin.marvin.lib.utils import *
+from tools.marvin.marvin.lib.base import *
+from tools.marvin.marvin.lib.common import *
+from nose.plugins.attrib import attr
+
+# Import System modules
+import time
+
+
+class TestQuotaTariffOrder(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        testClient = super(TestQuotaTariffOrder, cls).getClsTestClient()
+        cls.api_client = testClient.getApiClient()
+        cls.services = testClient.getParsedTestDataConfig()
+
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client)
+        cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+
+        # Create Account
+        cls.account = Account.create(
+            cls.api_client,
+            cls.services["account"],
+            domainid=cls.domain.id
+        )
+        cls._cleanup = [
+            cls.account,
+        ]

Review Comment:
   ```suggestion
           cls._cleanup = []
   
           # Create Account
           cls.account = Account.create(
               cls.api_client,
               cls.services["account"],
               domainid=cls.domain.id
           )
           cls._cleanup.append(cls.account)
   ```



-- 
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] Quota tariff order [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-1945632435

   @DaanHoogland a [SL] Trillian-Jenkins test job (alma9 mgmt + kvm-alma9) 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] Quota tariff order [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-1944209051

   @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.


-- 
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] Quota tariff order [cloudstack]

Posted by "JoaoJandre (via GitHub)" <gi...@apache.org>.
JoaoJandre commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-2048212606

   @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] Quota tariff order [cloudstack]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-2134470514

   This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.


-- 
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] Quota tariff order [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-2227074541

   @DaanHoogland a [SL] Trillian-Jenkins test job (alma9 mgmt + kvm-alma9) 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] Quota tariff order [cloudstack]

Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland merged PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347


-- 
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] Quota tariff order [cloudstack]

Posted by "GutoVeronezi (via GitHub)" <gi...@apache.org>.
GutoVeronezi commented on code in PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#discussion_r1491681359


##########
plugins/database/quota/src/main/java/org/apache/cloudstack/api/command/QuotaTariffUpdateCmd.java:
##########
@@ -67,6 +67,9 @@ public class QuotaTariffUpdateCmd extends BaseCmd {
             "value will be applied. Inform empty to remove the activation rule.", length = 65535, since = "4.18.0.0")
     private String activationRule;
 
+    @Parameter(name = ApiConstants.POSITION, type = CommandType.INTEGER, description = "Position in the execution sequence for tariffs of the same type", since = "4.19.0.0")

Review Comment:
   ```suggestion
       @Parameter(name = ApiConstants.POSITION, type = CommandType.INTEGER, description = "Position in the execution sequence for tariffs of the same type", since = "4.20.0.0")
   ```



##########
test/integration/plugins/test_quota_tariff_order.py:
##########
@@ -0,0 +1,189 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+""" Test cases for checking quota API
+"""
+
+# Import Local Modules
+import tools.marvin.marvin
+from tools.marvin.marvin.cloudstackTestCase import *
+from tools.marvin.marvin.cloudstackAPI import *
+from tools.marvin.marvin.lib.utils import *
+from tools.marvin.marvin.lib.base import *
+from tools.marvin.marvin.lib.common import *
+from nose.plugins.attrib import attr
+
+# Import System modules
+import time
+
+
+class TestQuotaTariffOrder(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        testClient = super(TestQuotaTariffOrder, cls).getClsTestClient()
+        cls.api_client = testClient.getApiClient()
+        cls.services = testClient.getParsedTestDataConfig()
+
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client)
+        cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+
+        # Create Account
+        cls.account = Account.create(
+            cls.api_client,
+            cls.services["account"],
+            domainid=cls.domain.id
+        )
+        cls._cleanup = [
+            cls.account,
+        ]
+
+        cls.services["account"] = cls.account.name
+
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            # Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.cleanup = []
+        self.tariffs = []
+        return
+
+    def tearDown(self):
+        try:
+            cleanup_resources(self.api_client, self.cleanup)
+            self.delete_tariffs()
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def delete_tariffs(self):
+        for tariff in self.tariffs:
+            cmd = quotaTariffDelete.quotaTariffDeleteCmd()
+            cmd.id = tariff.uuid
+            self.api_client.quotaTariffDelete(cmd)
+
+    @attr(
+        tags=[
+            "advanced",
+            "smoke"],
+        required_hardware="false")
+    def test_01_quota_tariff_order(self):
+        """Test Quota Tariff Order
+        """
+
+        cmd = quotaTariffCreate.quotaTariffCreateCmd()
+        cmd.name = 'tf1'
+        cmd.value = '1'
+        cmd.activationrule = '10'
+        cmd.usagetype = '22'
+        cmd.position = '2'
+        self.tariffs.append(self.api_client.quotaTariffCreate(cmd))
+
+        cmd = quotaTariffCreate.quotaTariffCreateCmd()
+        cmd.name = 'tf2'
+        cmd.value = '1'
+        cmd.activationrule = 'lastTariffs[lastTariffs.length -1].value + 7'
+        cmd.usagetype = '22'
+        cmd.position = '3'
+        self.tariffs.append(self.api_client.quotaTariffCreate(cmd))
+
+        cmd = quotaTariffCreate.quotaTariffCreateCmd()
+        cmd.name = 'tf3'
+        cmd.value = '1'
+        cmd.activationrule = 'lastTariffs[lastTariffs.length -2].value + lastTariffs[lastTariffs.length -1].value'
+        cmd.usagetype = '22'
+        cmd.position = '4'
+        self.tariffs.append(self.api_client.quotaTariffCreate(cmd))
+
+        cmd = quotaCredits.quotaCreditsCmd()
+        cmd.account = self.account.name
+        cmd.domainid = self.domain.id
+        cmd.value = 54
+        self.api_client.quotaCredits(cmd)
+
+        # Fetch account ID from account_uuid
+        self.debug("select id from account where uuid = '%s';"
+                   % self.account.id)
+
+        qresultset = self.dbclient.execute(
+            "select id from account where uuid = '%s';"
+            % self.account.id
+        )
+
+        account_id = qresultset[0][0]
+
+        self.debug("SELECT id from `domain` d WHERE uuid = '%s';"
+                   % self.domain.id)
+
+        qresultset = self.dbclient.execute(
+            "SELECT id from `domain` d WHERE uuid = '%s';"
+            % self.domain.id
+        )
+
+        domain_id = qresultset[0][0]
+
+        self.debug("SELECT id from data_center dc where dc.uuid = '%s';"
+                   % self.zone.id)
+
+        qresultset = self.dbclient.execute(
+            "SELECT id from data_center dc where dc.uuid = '%s';"
+            % self.zone.id
+        )
+
+        zone_id = qresultset[0][0]
+
+        start = datetime.datetime.now() + datetime.timedelta(seconds=1)
+        end = datetime.datetime.now() + datetime.timedelta(hours=1)
+
+        self.debug("INSERT INTO cloud_usage.cloud_usage (zone_id,account_id,domain_id,description,usage_display,"
+                   "usage_type,raw_usage,vm_instance_id,vm_name,offering_id,template_id,usage_id,`type`,`size`,"
+                   "network_id,start_date,end_date,virtual_size,cpu_speed,cpu_cores,memory,quota_calculated,"
+                   "is_hidden,state) VALUES ('{}','{}','{}','Test','1 Hrs',22,1,NULL,NULL,NULL,NULL,NULL,"
+                   "'VirtualMachine',NULL,NULL,'{}','{}',NULL,NULL,NULL,NULL,0,0,NULL);"
+                   .format(zone_id, account_id, domain_id, start, end))
+
+        self.dbclient.execute(
+            "INSERT INTO cloud_usage.cloud_usage (zone_id,account_id,domain_id,description,usage_display,usage_type,"
+            "raw_usage,vm_instance_id,vm_name,offering_id,template_id,usage_id,`type`,`size`,network_id,"
+            "start_date,end_date,virtual_size,cpu_speed,cpu_cores,memory,quota_calculated,is_hidden,"
+            "state) VALUES ('{}','{}','{}','Test','1 Hrs',22,1,NULL,NULL,NULL,NULL,NULL,'VirtualMachine',"
+            "NULL,NULL,'{}','{}',NULL,NULL,NULL,NULL,0,0,NULL);"
+            .format(zone_id, account_id, domain_id, start, end))

Review Comment:
   The string could be extracted to a variable.



##########
plugins/database/quota/src/main/java/org/apache/cloudstack/api/command/QuotaTariffCreateCmd.java:
##########
@@ -66,6 +66,9 @@ public class QuotaTariffCreateCmd extends BaseCmd {
             + " endDate=2009-06-03.")
     private Date endDate;
 
+    @Parameter(name = ApiConstants.POSITION, type = CommandType.INTEGER, description = "Position in the execution sequence for tariffs of the same type", since = "4.19.0.0")

Review Comment:
   ```suggestion
       @Parameter(name = ApiConstants.POSITION, type = CommandType.INTEGER, description = "Position in the execution sequence for tariffs of the same type", since = "4.20.0.0")
   ```



-- 
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] Quota tariff order [cloudstack]

Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on code in PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#discussion_r1494265022


##########
plugins/database/quota/src/main/java/org/apache/cloudstack/api/command/QuotaTariffCreateCmd.java:
##########
@@ -66,7 +66,7 @@ public class QuotaTariffCreateCmd extends BaseCmd {
             + " endDate=2009-06-03.")
     private Date endDate;
 
-    @Parameter(name = ApiConstants.POSITION, type = CommandType.INTEGER, description = "Position in the execution sequence for tariffs of the same type", since = "4.19.0.0")
+    @Parameter(name = ApiConstants.POSITION, type = CommandType.INTEGER, description = "Position in the execution sequence for tariffs of the same type", since = "4.20.0.0")

Review Comment:
   I don't think we need a vote for a change like this. The discussion did not lead to technical impediments. It is not forbidden to have a vote so since you ask for it, I will start one.



-- 
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] Quota tariff order [cloudstack]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-2059576066

   ## [Codecov](https://app.codecov.io/gh/apache/cloudstack/pull/8347?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) 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`)](https://app.codecov.io/gh/apache/cloudstack/commit/0e32380e0a3461c486161b330cd7807713a43ee1?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to head [(`38b1f00`)](https://app.codecov.io/gh/apache/cloudstack/pull/8347?dropdown=coverage&src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   > Report is 52 commits behind head on main.
   
   > :exclamation: Current head 38b1f00 differs from pull request most recent head ff7fa7c. Consider uploading reports for the commit ff7fa7c to get more accurate results
   
   | [Files](https://app.codecov.io/gh/apache/cloudstack/pull/8347?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [...e/cloudstack/api/command/QuotaTariffCreateCmd.java](https://app.codecov.io/gh/apache/cloudstack/pull/8347?src=pr&el=tree&filepath=plugins%2Fdatabase%2Fquota%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fcloudstack%2Fapi%2Fcommand%2FQuotaTariffCreateCmd.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGx1Z2lucy9kYXRhYmFzZS9xdW90YS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvY2xvdWRzdGFjay9hcGkvY29tbWFuZC9RdW90YVRhcmlmZkNyZWF0ZUNtZC5qYXZh) | 0.00% | [3 Missing :warning: ](https://app.codecov.io/gh/apache/cloudstack/pull/8347?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...e/cloudstack/api/command/QuotaTariffUpdateCmd.java](https://app.codecov.io/gh/apache/cloudstack/pull/8347?src=pr&el=tree&filepath=plugins%2Fdatabase%2Fquota%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fcloudstack%2Fapi%2Fcommand%2FQuotaTariffUpdateCmd.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGx1Z2lucy9kYXRhYmFzZS9xdW90YS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvY2xvdWRzdGFjay9hcGkvY29tbWFuZC9RdW90YVRhcmlmZlVwZGF0ZUNtZC5qYXZh) | 0.00% | [3 Missing :warning: ](https://app.codecov.io/gh/apache/cloudstack/pull/8347?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...udstack/api/response/QuotaResponseBuilderImpl.java](https://app.codecov.io/gh/apache/cloudstack/pull/8347?src=pr&el=tree&filepath=plugins%2Fdatabase%2Fquota%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fcloudstack%2Fapi%2Fresponse%2FQuotaResponseBuilderImpl.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGx1Z2lucy9kYXRhYmFzZS9xdW90YS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvY2xvdWRzdGFjay9hcGkvcmVzcG9uc2UvUXVvdGFSZXNwb25zZUJ1aWxkZXJJbXBsLmphdmE=) | 62.50% | [3 Missing :warning: ](https://app.codecov.io/gh/apache/cloudstack/pull/8347?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...k/quota/activationrule/presetvariables/Tariff.java](https://app.codecov.io/gh/apache/cloudstack/pull/8347?src=pr&el=tree&filepath=framework%2Fquota%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fcloudstack%2Fquota%2Factivationrule%2Fpresetvariables%2FTariff.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZnJhbWV3b3JrL3F1b3RhL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9jbG91ZHN0YWNrL3F1b3RhL2FjdGl2YXRpb25ydWxlL3ByZXNldHZhcmlhYmxlcy9UYXJpZmYuamF2YQ==) | 80.00% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/cloudstack/pull/8347?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [.../org/apache/cloudstack/quota/vo/QuotaTariffVO.java](https://app.codecov.io/gh/apache/cloudstack/pull/8347?src=pr&el=tree&filepath=framework%2Fquota%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fcloudstack%2Fquota%2Fvo%2FQuotaTariffVO.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZnJhbWV3b3JrL3F1b3RhL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9jbG91ZHN0YWNrL3F1b3RhL3ZvL1F1b3RhVGFyaWZmVk8uamF2YQ==) | 75.00% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/cloudstack/pull/8347?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...e/cloudstack/api/response/QuotaTariffResponse.java](https://app.codecov.io/gh/apache/cloudstack/pull/8347?src=pr&el=tree&filepath=plugins%2Fdatabase%2Fquota%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fcloudstack%2Fapi%2Fresponse%2FQuotaTariffResponse.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGx1Z2lucy9kYXRhYmFzZS9xdW90YS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvY2xvdWRzdGFjay9hcGkvcmVzcG9uc2UvUXVvdGFUYXJpZmZSZXNwb25zZS5qYXZh) | 66.66% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/cloudstack/pull/8347?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   ```diff
   @@             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](https://app.codecov.io/gh/apache/cloudstack/pull/8347/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [simulator-marvin-tests](https://app.codecov.io/gh/apache/cloudstack/pull/8347/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `24.61% <0.00%> (?)` | |
   | [uitests](https://app.codecov.io/gh/apache/cloudstack/pull/8347/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `4.34% <ø> (ø)` | |
   | [unit-tests](https://app.codecov.io/gh/apache/cloudstack/pull/8347/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `16.88% <65.71%> (?)` | |
   
   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/8347?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).
   


-- 
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] Quota tariff order [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-2219904427

   Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 10315


-- 
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] Quota tariff order [cloudstack]

Posted by "bernardodemarco (via GitHub)" <gi...@apache.org>.
bernardodemarco commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-2224081948

   @JoaoJandre, once this PR gets merged, I intend to add UI support for the position parameter on #9225.


-- 
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] Quota tariff order [cloudstack]

Posted by "JoaoJandre (via GitHub)" <gi...@apache.org>.
JoaoJandre commented on code in PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#discussion_r1492904222


##########
plugins/database/quota/src/main/java/org/apache/cloudstack/api/command/QuotaTariffCreateCmd.java:
##########
@@ -66,7 +66,7 @@ public class QuotaTariffCreateCmd extends BaseCmd {
             + " endDate=2009-06-03.")
     private Date endDate;
 
-    @Parameter(name = ApiConstants.POSITION, type = CommandType.INTEGER, description = "Position in the execution sequence for tariffs of the same type", since = "4.19.0.0")
+    @Parameter(name = ApiConstants.POSITION, type = CommandType.INTEGER, description = "Position in the execution sequence for tariffs of the same type", since = "4.20.0.0")

Review Comment:
   We better wait for the vote to change this I guess.



##########
plugins/database/quota/src/main/java/org/apache/cloudstack/api/command/QuotaTariffUpdateCmd.java:
##########
@@ -67,7 +67,7 @@ public class QuotaTariffUpdateCmd extends BaseCmd {
             "value will be applied. Inform empty to remove the activation rule.", length = 65535, since = "4.18.0.0")
     private String activationRule;
 
-    @Parameter(name = ApiConstants.POSITION, type = CommandType.INTEGER, description = "Position in the execution sequence for tariffs of the same type", since = "4.19.0.0")
+    @Parameter(name = ApiConstants.POSITION, type = CommandType.INTEGER, description = "Position in the execution sequence for tariffs of the same type", since = "4.20.0.0")

Review Comment:
   same
   



-- 
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] Quota tariff order [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-1944314955

   Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 8651


-- 
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] Quota tariff order [cloudstack]

Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-1945631951

   @blueorangutan test alma9 kvm-alma9


-- 
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] Quota tariff order [cloudstack]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-1998899302

   This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.


-- 
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] Quota tariff order [cloudstack]

Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-2219750524

   @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] Quota tariff order [cloudstack]

Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland closed pull request #8347: Quota tariff order
URL: https://github.com/apache/cloudstack/pull/8347


-- 
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] Quota tariff order [cloudstack]

Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on code in PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#discussion_r1492827492


##########
plugins/database/quota/src/main/java/org/apache/cloudstack/api/command/QuotaTariffUpdateCmd.java:
##########
@@ -67,7 +67,7 @@ public class QuotaTariffUpdateCmd extends BaseCmd {
             "value will be applied. Inform empty to remove the activation rule.", length = 65535, since = "4.18.0.0")
     private String activationRule;
 
-    @Parameter(name = ApiConstants.POSITION, type = CommandType.INTEGER, description = "Position in the execution sequence for tariffs of the same type", since = "4.19.0.0")
+    @Parameter(name = ApiConstants.POSITION, type = CommandType.INTEGER, description = "Position in the execution sequence for tariffs of the same type", since = "4.20.0.0")

Review Comment:
   ```suggestion
       @Parameter(name = ApiConstants.POSITION, type = CommandType.INTEGER, description = "Position in the execution sequence for tariffs of the same type", since = "20.0.0")
   ```
   ?



##########
plugins/database/quota/src/main/java/org/apache/cloudstack/api/command/QuotaTariffCreateCmd.java:
##########
@@ -66,7 +66,7 @@ public class QuotaTariffCreateCmd extends BaseCmd {
             + " endDate=2009-06-03.")
     private Date endDate;
 
-    @Parameter(name = ApiConstants.POSITION, type = CommandType.INTEGER, description = "Position in the execution sequence for tariffs of the same type", since = "4.19.0.0")
+    @Parameter(name = ApiConstants.POSITION, type = CommandType.INTEGER, description = "Position in the execution sequence for tariffs of the same type", since = "4.20.0.0")

Review Comment:
   should we start using three digit numbers?
   ```suggestion
       @Parameter(name = ApiConstants.POSITION, type = CommandType.INTEGER, description = "Position in the execution sequence for tariffs of the same type", since = "20.0.0")
   ```



-- 
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] Quota tariff order [cloudstack]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-1985459405

   This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.


-- 
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] Quota tariff order [cloudstack]

Posted by "JoaoJandre (via GitHub)" <gi...@apache.org>.
JoaoJandre commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-1944205535

   @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] Quota tariff order [cloudstack]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-2144358221

   This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.


-- 
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] Quota tariff order [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-2160666807

   Packaging result [SF]: ✖️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 9864


-- 
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] Quota tariff order [cloudstack]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-1964318755

   This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.


-- 
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] Quota tariff order [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-2048329441

   Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 9221


-- 
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] Quota tariff order [cloudstack]

Posted by "hsato03 (via GitHub)" <gi...@apache.org>.
hsato03 commented on code in PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#discussion_r1561383592


##########
framework/quota/src/main/java/org/apache/cloudstack/quota/QuotaManagerImpl.java:
##########
@@ -367,9 +369,22 @@ protected BigDecimal aggregateQuotaTariffsValues(UsageVO usageRecord, List<Quota
         PresetVariables presetVariables = getPresetVariables(hasAnyQuotaTariffWithActivationRule, usageRecord);
         BigDecimal aggregatedQuotaTariffsValue = BigDecimal.ZERO;
 
+        quotaTariffs.sort(Comparator.comparing(QuotaTariffVO::getPosition));
+
+        List<Tariff> lastTariffs = new ArrayList<>();
+
+
         for (QuotaTariffVO quotaTariff : quotaTariffs) {
             if (isQuotaTariffInPeriodToBeApplied(usageRecord, quotaTariff, accountToString)) {
-                aggregatedQuotaTariffsValue = aggregatedQuotaTariffsValue.add(getQuotaTariffValueToBeApplied(quotaTariff, jsInterpreter, presetVariables));
+
+                BigDecimal tariffValue = getQuotaTariffValueToBeApplied(quotaTariff, jsInterpreter, presetVariables, lastTariffs);
+
+                aggregatedQuotaTariffsValue = aggregatedQuotaTariffsValue.add(tariffValue);
+
+                Tariff tariffPresetVariable = new Tariff();
+                tariffPresetVariable.setId(quotaTariff.getUuid());
+                tariffPresetVariable.setValue(tariffValue);
+                lastTariffs.add(tariffPresetVariable);

Review Comment:
   Should this block be executed even when the tariff does not have an activation rule?



-- 
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] Quota tariff order [cloudstack]

Posted by "JoaoJandre (via GitHub)" <gi...@apache.org>.
JoaoJandre commented on code in PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#discussion_r1561533659


##########
framework/quota/src/main/java/org/apache/cloudstack/quota/QuotaManagerImpl.java:
##########
@@ -367,9 +369,22 @@ protected BigDecimal aggregateQuotaTariffsValues(UsageVO usageRecord, List<Quota
         PresetVariables presetVariables = getPresetVariables(hasAnyQuotaTariffWithActivationRule, usageRecord);
         BigDecimal aggregatedQuotaTariffsValue = BigDecimal.ZERO;
 
+        quotaTariffs.sort(Comparator.comparing(QuotaTariffVO::getPosition));
+
+        List<Tariff> lastTariffs = new ArrayList<>();
+
+
         for (QuotaTariffVO quotaTariff : quotaTariffs) {
             if (isQuotaTariffInPeriodToBeApplied(usageRecord, quotaTariff, accountToString)) {
-                aggregatedQuotaTariffsValue = aggregatedQuotaTariffsValue.add(getQuotaTariffValueToBeApplied(quotaTariff, jsInterpreter, presetVariables));
+
+                BigDecimal tariffValue = getQuotaTariffValueToBeApplied(quotaTariff, jsInterpreter, presetVariables, lastTariffs);
+
+                aggregatedQuotaTariffsValue = aggregatedQuotaTariffsValue.add(tariffValue);
+
+                Tariff tariffPresetVariable = new Tariff();
+                tariffPresetVariable.setId(quotaTariff.getUuid());
+                tariffPresetVariable.setValue(tariffValue);
+                lastTariffs.add(tariffPresetVariable);

Review Comment:
   The tariff does not need an activation rule to have a position. You could have a tariff with only a value but at position 2 if you wanted.



-- 
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] Quota tariff order [cloudstack]

Posted by "hsato03 (via GitHub)" <gi...@apache.org>.
hsato03 commented on code in PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#discussion_r1561549494


##########
framework/quota/src/main/java/org/apache/cloudstack/quota/QuotaManagerImpl.java:
##########
@@ -367,9 +369,22 @@ protected BigDecimal aggregateQuotaTariffsValues(UsageVO usageRecord, List<Quota
         PresetVariables presetVariables = getPresetVariables(hasAnyQuotaTariffWithActivationRule, usageRecord);
         BigDecimal aggregatedQuotaTariffsValue = BigDecimal.ZERO;
 
+        quotaTariffs.sort(Comparator.comparing(QuotaTariffVO::getPosition));
+
+        List<Tariff> lastTariffs = new ArrayList<>();
+
+
         for (QuotaTariffVO quotaTariff : quotaTariffs) {
             if (isQuotaTariffInPeriodToBeApplied(usageRecord, quotaTariff, accountToString)) {
-                aggregatedQuotaTariffsValue = aggregatedQuotaTariffsValue.add(getQuotaTariffValueToBeApplied(quotaTariff, jsInterpreter, presetVariables));
+
+                BigDecimal tariffValue = getQuotaTariffValueToBeApplied(quotaTariff, jsInterpreter, presetVariables, lastTariffs);
+
+                aggregatedQuotaTariffsValue = aggregatedQuotaTariffsValue.add(tariffValue);
+
+                Tariff tariffPresetVariable = new Tariff();
+                tariffPresetVariable.setId(quotaTariff.getUuid());
+                tariffPresetVariable.setValue(tariffValue);
+                lastTariffs.add(tariffPresetVariable);

Review Comment:
   I mean, should the preset variable be created in this case?



-- 
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] Quota tariff order [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-2160518905

   @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.


-- 
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] Quota tariff order [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-2219751981

   @DaanHoogland 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.


-- 
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] Quota tariff order [cloudstack]

Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-2227297553

   <b>[SF] Trillian test result (tid-10824)</b>
   Environment: kvm-alma9 (x2), Advanced Networking with Mgmt server a9
   Total time taken: 51626 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr8347-t10824-kvm-alma9.zip
   Smoke tests completed. 136 look OK, 1 have errors, 0 did not run
   Only failed and skipped tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   test_06_purge_expunged_vm_background_task | `Failure` | 337.45 | test_purge_expunged_vms.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] Quota tariff order [cloudstack]

Posted by "JoaoJandre (via GitHub)" <gi...@apache.org>.
JoaoJandre commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-1997391707

   @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] Quota tariff order [cloudstack]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #8347:
URL: https://github.com/apache/cloudstack/pull/8347#issuecomment-1994391386

   This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.


-- 
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