Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Quota] Improve Quota balance calculation flow #8581

Merged

Conversation

BryanMLima
Copy link
Contributor

@BryanMLima BryanMLima commented Jan 31, 2024

Description

This PR aims to improve the overall Quota balance calculation by breaking into separate methods and calculating based on the period dates rather than the Quota usage records for a better understanding of its flow. This PR also introduces smoke test for Quota balance and normalized the aggregation usage calculation when it is not daily or hourly.

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

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

How Has This Been Tested?

  1. Create a quota tariff with the usage type 6 (i.e. volume).
  2. Created an account.
  3. Added credits to the account.
  4. Created a volume assigned to the newly created account.
  5. Verified that the account balance was consistent with the tariff value.
id   |account_id|domain_id|credit_balance|credits_id|updated_on         |
-----+----------+---------+--------------+----------+-------------------+
12876|        47|        1|  100.00000000|        26|2024-01-31 16:40:11|
12879|        47|        1|    0.00000000|         0|2024-01-31 16:39:00|
12880|        47|        1|   92.85277786|         0|2024-01-31 16:40:59|
12883|        47|        1|   82.51944399|         0|2024-01-31 16:42:59|
12886|        47|        1|   72.18611012|         0|2024-01-31 16:44:59|
12889|        47|        1|   61.85277625|         0|2024-01-31 16:46:59|

How did you try to break this feature and the system with this change?

I also tried to invert the steps in the test above

  1. Create a quota tariff with the usage type 6 (i.e. volume).
  2. Created an account.
  3. Created a volume assigned to the newly created account.
  4. Added credits to the account.
  5. Verified that the account balance was consistent with the tariff value.
id   |account_id|domain_id|credit_balance|credits_id|updated_on         |
-----+----------+---------+--------------+----------+-------------------+
12894|        48|        1|   50.00000000|        28|2024-01-31 16:51:34|
12901|        48|        1|    0.00000000|         0|2024-01-31 16:51:00|
12902|        48|        1|   44.83333306|         0|2024-01-31 16:52:59|
12906|        48|        1|   34.49999919|         0|2024-01-31 16:54:59|
12910|        48|        1|   24.16666532|         0|2024-01-31 16:56:59|

@BryanMLima
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

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

Copy link

codecov bot commented Jan 31, 2024

Codecov Report

Attention: Patch coverage is 0% with 35 lines in your changes missing coverage. Please review.

Project coverage is 14.95%. Comparing base (ea9a0f4) to head (38f9ddf).
Report is 58 commits behind head on 4.19.

Files Patch % Lines
.../org/apache/cloudstack/quota/QuotaManagerImpl.java 0.00% 30 Missing ⚠️
...rc/main/java/com/cloud/usage/UsageManagerImpl.java 0.00% 5 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               4.19    #8581      +/-   ##
============================================
- Coverage     14.96%   14.95%   -0.01%     
- Complexity    10995    11010      +15     
============================================
  Files          5373     5378       +5     
  Lines        469024   469802     +778     
  Branches      58818    57316    -1502     
============================================
+ Hits          70197    70277      +80     
- Misses       391056   391740     +684     
- Partials       7771     7785      +14     
Flag Coverage Δ
uitests 4.29% <ø> (-0.03%) ⬇️
unittests 15.67% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@blueorangutan
Copy link

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

@BryanMLima
Copy link
Contributor Author

@JoaoJandre, do you think this PR can go to the 4.18.2.0 release?

@DaanHoogland
Copy link
Contributor

@blueorangutan test

@blueorangutan
Copy link

@DaanHoogland a [SL] Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

@JoaoJandre
Copy link
Contributor

@JoaoJandre, do you think this PR can go to the 4.18.2.0 release?

@BryanMLima sure

@JoaoJandre JoaoJandre added this to the 4.18.2.0 milestone Feb 1, 2024
@blueorangutan
Copy link

[SF] Trillian test result (tid-9039)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 41289 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr8581-t9039-kvm-centos7.zip
Smoke tests completed. 110 look OK, 0 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File

@BryanMLima
Copy link
Contributor Author

[SF] Trillian test result (tid-9039) Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7 Total time taken: 41289 seconds Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr8581-t9039-kvm-centos7.zip Smoke tests completed. 110 look OK, 0 have errors, 0 did not run Only failed and skipped tests results shown below:
Test Result Time (s) Test File

@DaanHoogland, I don't think the added integration test ran. Does it need something more to run the integration tests in the plugin folder?

@DaanHoogland
Copy link
Contributor

@BryanMLima tests from test/integration/plugins are not run in the smoke tests. You can try adding it to the test matrix. see the test matrix

@JoaoJandre JoaoJandre mentioned this pull request Feb 5, 2024
8 tasks
Copy link
Contributor

@SadiJr SadiJr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CLGTM

@DaanHoogland
Copy link
Contributor

@BryanMLima it passed. not sure if we should add more runners, but a runner for plugins in general would make sense.

@BryanMLima BryanMLima marked this pull request as draft February 12, 2024 13:57
@BryanMLima
Copy link
Contributor Author

@BryanMLima it passed. not sure if we should add more runners, but a runner for plugins in general would make sense.

@DaanHoogland, the test should have not passed, as it threw an exception in the CI logs, I will take a look.

@DaanHoogland
Copy link
Contributor

@BryanMLima as you are still working on this, does it make sense to take it out of the milestone? cc @JoaoJandre

@BryanMLima
Copy link
Contributor Author

@BryanMLima as you are still working on this, does it make sense to take it out of the milestone? cc @JoaoJandre

@DaanHoogland, I will have a look, should be able to fix this PR, at max, late next week.

@BryanMLima BryanMLima marked this pull request as ready for review March 15, 2024 20:29
@JoaoJandre JoaoJandre modified the milestones: 4.18.2.0, 4.18.3 Mar 21, 2024
@BryanMLima BryanMLima closed this May 10, 2024
@BryanMLima BryanMLima reopened this May 10, 2024
@BryanMLima
Copy link
Contributor Author

@DaanHoogland, as you have more experience with the test matrix, did it ever happen in a scenario when the API had an incorrect signature, such as errorText:unable to verify user credentials and/or request signature? I can run the Quota plugin test in my local lab, however, the matrix test points out this signature error https://github.com/apache/cloudstack/actions/runs/9036087020/job/24832224476?pr=8581. I'm willing to remove this test from the matrix as I do not have a clue to why this happens.

@DaanHoogland
Copy link
Contributor

@DaanHoogland, as you have more experience with the test matrix, did it ever happen in a scenario when the API had an incorrect signature, such as errorText:unable to verify user credentials and/or request signature? I can run the Quota plugin test in my local lab, however, the matrix test points out this signature error https://github.com/apache/cloudstack/actions/runs/9036087020/job/24832224476?pr=8581. I'm willing to remove this test from the matrix as I do not have a clue to why this happens.

guess this time around it didn't fail?

@BryanMLima
Copy link
Contributor Author

@DaanHoogland, as you have more experience with the test matrix, did it ever happen in a scenario when the API had an incorrect signature, such as errorText:unable to verify user credentials and/or request signature? I can run the Quota plugin test in my local lab, however, the matrix test points out this signature error https://github.com/apache/cloudstack/actions/runs/9036087020/job/24832224476?pr=8581. I'm willing to remove this test from the matrix as I do not have a clue to why this happens.

guess this time around it didn't fail?

Nope, it still had the same error, even though the test is marked as “passed”. I removed the Quota plugin smoke test from the test matrix as I could not find the reason for the error message. The results from running the integration tests in my local lab is presented below for verification:

runinfo
2024-05-22 18:01:14,332 - DEBUG - Payload: {'account': 'admin', 'command': 'listUsers', 'response': 'json'}
2024-05-22 18:01:14,332 - DEBUG - ========Sending GET Cmd : listUsers=======
2024-05-22 18:01:14,346 - DEBUG - Response : [{id : '0f29064e-8a09-11ee-b655-525400627401', username : 'admin', firstname : 'admin', lastname : 'cloud', created : '2023-11-23T14:03:20+0000', state : 'enabled', account : 'admin', accounttype : 1, usersource : 'native', roleid : '09360ed0-8a09-11ee-b655-525400627401', roletype : 'Admin', rolename : 'Root Admin', domainid : '0091d3ad-8a09-11ee-b655-525400627401', domain : 'ROOT', apikey : 'TEYzt4GLXLz4859ncH84qCN84Lq6gQ0KIGWCz_xmchYBmESpqLobKaYV4lR1h2hMNyDWItpCJbYMcTPIZLQuow', accountid : '0f27e443-8a09-11ee-b655-525400627401', iscallerchilddomain : False, isdefault : True, is2faenabled : False, is2famandated : False}, {id : '18b84e66-8338-4b41-b0d0-facc5b82ba0f', username : 'teste', firstname : 'teste', lastname : 'teste', email : 'teste', created : '2024-03-28T18:16:22+0000', state : 'enabled', account : 'admin', accounttype : 1, usersource : 'native', roleid : '09360ed0-8a09-11ee-b655-525400627401', roletype : 'Admin', rolename : 'Root Admin', domainid : '0091d3ad-8a09-11ee-b655-525400627401', domain : 'ROOT', timezone : 'Etc/GMT-3', accountid : '0f27e443-8a09-11ee-b655-525400627401', iscallerchilddomain : False, isdefault : False, is2faenabled : False, is2famandated : False}]
2024-05-22 18:01:14,346 - DEBUG - Payload: {'id': '0f29064e-8a09-11ee-b655-525400627401', 'command': 'getUserKeys', 'response': 'json'}
2024-05-22 18:01:14,346 - DEBUG - ========Sending GET Cmd : getUserKeys=======
2024-05-22 18:01:14,354 - DEBUG - Response : {apikey : 'TEYzt4GLXLz4859ncH84qCN84Lq6gQ0KIGWCz_xmchYBmESpqLobKaYV4lR1h2hMNyDWItpCJbYMcTPIZLQuow', secretkey : 'i6K3V2Qggc7tb2KILyEQq-6jVECahwP6MODmDR1-RZC45VSj8vCAr9qIjXTFHIggyjvJDhuIJAmmJ--UwgamtA'}
2024-05-22 18:01:14,354 - DEBUG - ==== Test Client Creation Successful ====
2024-05-22 18:01:14,399 - DEBUG - Payload: {'command': 'listDomains', 'response': 'json', 'apiKey': 'TEYzt4GLXLz4859ncH84qCN84Lq6gQ0KIGWCz_xmchYBmESpqLobKaYV4lR1h2hMNyDWItpCJbYMcTPIZLQuow', 'signature': b'Y0pChHXtWOHAjUO1E+i1+peq90g='}
2024-05-22 18:01:14,399 - DEBUG - ========Sending GET Cmd : listDomains=======
2024-05-22 18:01:14,414 - DEBUG - Response : [{id : '0091d3ad-8a09-11ee-b655-525400627401', name : 'ROOT', level : 0, haschild : True, path : 'ROOT', state : 'Active', vmlimit : 'Unlimited', vmtotal : 5, vmavailable : 'Unlimited', iplimit : 'Unlimited', iptotal : 4, ipavailable : 'Unlimited', volumelimit : 'Unlimited', volumetotal : 9, volumeavailable : 'Unlimited', snapshotlimit : 'Unlimited', snapshottotal : 1, snapshotavailable : 'Unlimited', templatelimit : 'Unlimited', templatetotal : 18, templateavailable : 'Unlimited', projectlimit : 'Unlimited', projecttotal : 4, projectavailable : 'Unlimited', networklimit : 'Unlimited', networktotal : 6, networkavailable : 'Unlimited', vpclimit : 'Unlimited', vpctotal : 2, vpcavailable : 'Unlimited', cpulimit : 'Unlimited', cputotal : 10, cpuavailable : 'Unlimited', memorylimit : 'Unlimited', memorytotal : 2560, memoryavailable : 'Unlimited', primarystoragelimit : 'Unlimited', primarystoragetotal : 59, primarystorageavailable : 'Unlimited', secondarystoragelimit : 'Unlimited', secondarystoragetotal : 38.638916, secondarystorageavailable : 'Unlimited', hasannotations : False}, {id : '5b0d718b-4e67-45a6-91b7-ba78532e70c7', name : 'dom-01', level : 1, parentdomainid : '0091d3ad-8a09-11ee-b655-525400627401', parentdomainname : 'ROOT', haschild : False, path : 'ROOT/dom-01', state : 'Active', created : '2024-03-07T12:56:08+0000', vmlimit : 'Unlimited', vmtotal : 0, vmavailable : 'Unlimited', iplimit : 'Unlimited', iptotal : 0, ipavailable : 'Unlimited', volumelimit : 'Unlimited', volumetotal : 0, volumeavailable : 'Unlimited', snapshotlimit : 'Unlimited', snapshottotal : 0, snapshotavailable : 'Unlimited', templatelimit : 'Unlimited', templatetotal : 0, templateavailable : 'Unlimited', projectlimit : 'Unlimited', projecttotal : 0, projectavailable : 'Unlimited', networklimit : 'Unlimited', networktotal : 1, networkavailable : 'Unlimited', vpclimit : 'Unlimited', vpctotal : 0, vpcavailable : 'Unlimited', cpulimit : 'Unlimited', cputotal : 0, cpuavailable : 'Unlimited', memorylimit : 'Unlimited', memorytotal : 0, memoryavailable : 'Unlimited', primarystoragelimit : 'Unlimited', primarystoragetotal : 0, primarystorageavailable : 'Unlimited', secondarystoragelimit : 'Unlimited', secondarystoragetotal : 0.0, secondarystorageavailable : 'Unlimited', hasannotations : False}, {id : 'bac92a71-78fa-405d-aa32-93325739b108', name : 'dom-02', level : 1, parentdomainid : '0091d3ad-8a09-11ee-b655-525400627401', parentdomainname : 'ROOT', haschild : False, path : 'ROOT/dom-02', state : 'Active', created : '2024-03-07T12:56:17+0000', vmlimit : 'Unlimited', vmtotal : 0, vmavailable : 'Unlimited', iplimit : 'Unlimited', iptotal : 0, ipavailable : 'Unlimited', volumelimit : 'Unlimited', volumetotal : 0, volumeavailable : 'Unlimited', snapshotlimit : 'Unlimited', snapshottotal : 0, snapshotavailable : 'Unlimited', templatelimit : 'Unlimited', templatetotal : 0, templateavailable : 'Unlimited', projectlimit : 'Unlimited', projecttotal : 0, projectavailable : 'Unlimited', networklimit : 'Unlimited', networktotal : 1, networkavailable : 'Unlimited', vpclimit : 'Unlimited', vpctotal : 0, vpcavailable : 'Unlimited', cpulimit : 'Unlimited', cputotal : 0, cpuavailable : 'Unlimited', memorylimit : 'Unlimited', memorytotal : 0, memoryavailable : 'Unlimited', primarystoragelimit : 'Unlimited', primarystoragetotal : 0, primarystorageavailable : 'Unlimited', secondarystoragelimit : 'Unlimited', secondarystoragetotal : 0.0, secondarystorageavailable : 'Unlimited', hasannotations : False}]
2024-05-22 18:01:14,414 - DEBUG - Payload: {'command': 'listZones', 'response': 'json', 'apiKey': 'TEYzt4GLXLz4859ncH84qCN84Lq6gQ0KIGWCz_xmchYBmESpqLobKaYV4lR1h2hMNyDWItpCJbYMcTPIZLQuow', 'signature': b'4dU6CeB0HDQKtimPFd88zc/0SNM='}
2024-05-22 18:01:14,414 - DEBUG - ========Sending GET Cmd : listZones=======
2024-05-22 18:01:14,425 - DEBUG - Response : [{id : '7cdd9941-5bb5-4717-9afb-8cf803340253', name : 'zona-01', dns1 : '8.8.8.8', dns2 : '8.8.4.4', ip6dns1 : '2001:4860:4860::8888', ip6dns2 : '2001:4860:4860::8844', internaldns1 : '8.8.8.8', guestcidraddress : '10.1.1.0/24', networktype : 'Advanced', securitygroupsenabled : False, allocationstate : 'Enabled', zonetoken : '6d4041a1-2b2a-31e5-a39f-77d769a56bf4', dhcpprovider : 'VirtualRouter', localstorageenabled : False, tags : [], allowuserspecifyvrmtu : False, routerprivateinterfacemaxmtu : 1500, routerpublicinterfacemaxmtu : 1500, type : 'Core', hasannotations : False}]
2024-05-22 18:01:14,425 - DEBUG - Payload: {'accounttype': 0, 'domainid': '0091d3ad-8a09-11ee-b655-525400627401', 'email': 'test-account@test.com', 'firstname': 'test', 'lastname': 'test', 'password': 'password', 'username': 'test-a-TestQuotaBalance-VY6ACZ', 'command': 'createAccount', 'response': 'json', 'apiKey': 'TEYzt4GLXLz4859ncH84qCN84Lq6gQ0KIGWCz_xmchYBmESpqLobKaYV4lR1h2hMNyDWItpCJbYMcTPIZLQuow', 'signature': b'D3X9W8r6wRY0m252Cyxj7zmPLrs='}
2024-05-22 18:01:14,425 - DEBUG - ========Sending GET Cmd : createAccount=======
2024-05-22 18:01:15,661 - DEBUG - Response : {id : 'c9f3f97a-7a43-4b25-8de1-fe69dddf3de1', name : 'test-a-TestQuotaBalance-VY6ACZ', accounttype : 0, roleid : '09362ada-8a09-11ee-b655-525400627401', roletype : 'User', rolename : 'User', domainid : '0091d3ad-8a09-11ee-b655-525400627401', domain : 'ROOT', domainpath : 'ROOT', vmlimit : '20', vmtotal : 0, vmavailable : '20', iplimit : '20', iptotal : 0, ipavailable : '14', volumelimit : '20', volumetotal : 0, volumeavailable : '20', snapshotlimit : '20', snapshottotal : 0, snapshotavailable : '20', templatelimit : '20', templatetotal : 0, templateavailable : '20', vmstopped : 0, vmrunning : 0, projectlimit : 'Unlimited', projecttotal : 0, projectavailable : 'Unlimited', networklimit : '20', networktotal : 0, networkavailable : '20', vpclimit : '20', vpctotal : 0, vpcavailable : '20', cpulimit : '40', cputotal : 0, cpuavailable : '40', memorylimit : '40960', memorytotal : 0, memoryavailable : '40960', primarystoragelimit : '200', primarystoragetotal : 0, primarystorageavailable : '200', secondarystoragelimit : '400', secondarystoragetotal : 0.0, secondarystorageavailable : '400.0', state : 'enabled', created : '2024-05-22T18:01:14+0000', user : [{id : 'ab903070-ab76-432b-928c-dd1e392409c8', username : 'test-a-TestQuotaBalance-VY6ACZ', firstname : 'test', lastname : 'test', email : 'test-account@test.com', created : '2024-05-22T18:01:15+0000', state : 'enabled', account : 'test-a-TestQuotaBalance-VY6ACZ', accounttype : 0, usersource : 'native', roleid : '09362ada-8a09-11ee-b655-525400627401', roletype : 'User', rolename : 'User', domainid : '0091d3ad-8a09-11ee-b655-525400627401', domain : 'ROOT', accountid : 'c9f3f97a-7a43-4b25-8de1-fe69dddf3de1', iscallerchilddomain : False, isdefault : False, is2faenabled : False, is2famandated : False}], isdefault : False, groups : []}
2024-05-22 18:01:15,662 - DEBUG - Payload: {'name': 'quota.enable.service', 'command': 'listConfigurations', 'response': 'json', 'apiKey': 'TEYzt4GLXLz4859ncH84qCN84Lq6gQ0KIGWCz_xmchYBmESpqLobKaYV4lR1h2hMNyDWItpCJbYMcTPIZLQuow', 'signature': b'UVy/pmDd15hlvHMF62GKH5VvBrw='}
2024-05-22 18:01:15,662 - DEBUG - ========Sending GET Cmd : listConfigurations=======
2024-05-22 18:01:15,673 - DEBUG - Response : [{category : 'Advanced', group : 'Miscellaneous', subgroup : 'Quota', name : 'quota.enable.service', value : 'true', defaultvalue : 'false', description : 'Indicates whether Quota plugin is enabled or not.', isdynamic : True, component : 'QUOTA-PLUGIN', displaytext : 'Quota enable service', type : 'Boolean'}]
2024-05-22 18:01:15,673 - DEBUG - ::::::::::::STARTED : TC: test_quota_balance :::::::::::
2024-05-22 18:01:15,673 - DEBUG - Payload: {'name': 'Tariff', 'usagetype': '21', 'value': '10', 'command': 'quotaTariffCreate', 'response': 'json', 'apiKey': 'TEYzt4GLXLz4859ncH84qCN84Lq6gQ0KIGWCz_xmchYBmESpqLobKaYV4lR1h2hMNyDWItpCJbYMcTPIZLQuow', 'signature': b'5b0d+bFtirR1MdJqKbfNST+EPlA='}
2024-05-22 18:01:15,673 - DEBUG - ========Sending GET Cmd : quotaTariffCreate=======
2024-05-22 18:01:15,685 - DEBUG - Response : {usageType : 21, usageName : 'VM_DISK_IO_READ', usageUnit : 'IOPS', usageDiscriminator : 'None', tariffValue : 10.0, effectiveDate : '2024-05-22T18:01:15+0000', usageTypeDescription : 'VM Disk usage(I/O Read)', currency : '$', name : 'Tariff', uuid : 'bfc7b781-a913-47e4-8822-0971a20e0eb2'}
2024-05-22 18:01:15,686 - DEBUG - Payload: {'account': 'test-a-TestQuotaBalance-VY6ACZ', 'domainid': '0091d3ad-8a09-11ee-b655-525400627401', 'value': 100, 'command': 'quotaCredits', 'response': 'json', 'apiKey': 'TEYzt4GLXLz4859ncH84qCN84Lq6gQ0KIGWCz_xmchYBmESpqLobKaYV4lR1h2hMNyDWItpCJbYMcTPIZLQuow', 'signature': b'XUYvqzJt1NqDSfaYjBFNGCYN+Ac='}
2024-05-22 18:01:15,686 - DEBUG - ========Sending GET Cmd : quotaCredits=======
2024-05-22 18:01:15,707 - DEBUG - Response : {credits : 100.0, updated_by : 'admin', updated_on : '2024-05-22T18:01:15+0000', currency : '$'}
2024-05-22 18:01:15,707 - DEBUG - SELECT id FROM account WHERE uuid = 'c9f3f97a-7a43-4b25-8de1-fe69dddf3de1';
2024-05-22 18:01:15,719 - DEBUG - SELECT id FROM `domain` d WHERE uuid = '0091d3ad-8a09-11ee-b655-525400627401';
2024-05-22 18:01:15,719 - DEBUG - SELECT id from data_center dc where dc.uuid = '7cdd9941-5bb5-4717-9afb-8cf803340253';
2024-05-22 18:01:15,720 - 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 ('1','15','1','Test','1 Hrs',21,1,NULL,NULL,NULL,NULL,NULL,'VirtualMachine',NULL,NULL,'2024-05-22 18:01:16.720264','2024-05-22 19:01:15.720268',NULL,NULL,NULL,NULL,0,0,NULL);
2024-05-22 18:01:15,725 - DEBUG - Payload: {'command': 'quotaUpdate', 'response': 'json', 'apiKey': 'TEYzt4GLXLz4859ncH84qCN84Lq6gQ0KIGWCz_xmchYBmESpqLobKaYV4lR1h2hMNyDWItpCJbYMcTPIZLQuow', 'signature': b'9vuc8rfhhw4Fd1DuViOe1xQkvaw='}
2024-05-22 18:01:15,725 - DEBUG - ========Sending GET Cmd : quotaUpdate=======
2024-05-22 18:01:15,971 - DEBUG - Response : {updated_on : '2024-05-22T18:01:15+0000'}
2024-05-22 18:01:15,972 - DEBUG - Payload: {'account': 'test-a-TestQuotaBalance-VY6ACZ', 'domainid': '0091d3ad-8a09-11ee-b655-525400627401', 'command': 'quotaBalance', 'response': 'json', 'apiKey': 'TEYzt4GLXLz4859ncH84qCN84Lq6gQ0KIGWCz_xmchYBmESpqLobKaYV4lR1h2hMNyDWItpCJbYMcTPIZLQuow', 'signature': b'leazn9esaIHbEoAneju3UKgObDU='}
2024-05-22 18:01:15,972 - DEBUG - ========Sending GET Cmd : quotaBalance=======
2024-05-22 18:01:15,986 - DEBUG - Response : {balance : {startquota : 90.0, credits : [], startdate : '2024-05-22T18:01:15+0000', currency : '$'}}
2024-05-22 18:01:15,986 - DEBUG - The quota balance for the account test-a-TestQuotaBalance-VY6ACZ is {startquota : 90.0, credits : [], startdate : '2024-05-22T18:01:15+0000', currency : '$'}.
2024-05-22 18:01:15,986 - DEBUG - Payload: {'id': 'bfc7b781-a913-47e4-8822-0971a20e0eb2', 'command': 'quotaTariffDelete', 'response': 'json', 'apiKey': 'TEYzt4GLXLz4859ncH84qCN84Lq6gQ0KIGWCz_xmchYBmESpqLobKaYV4lR1h2hMNyDWItpCJbYMcTPIZLQuow', 'signature': b'7DStIC0t5INPrXAdLio+UjvmFgY='}
2024-05-22 18:01:15,986 - DEBUG - ========Sending GET Cmd : quotaTariffDelete=======
2024-05-22 18:01:16,003 - DEBUG - Response : {success : True}
2024-05-22 18:01:16,004 - DEBUG - TestCaseName: test_quota_balance; Time Taken: 0 Seconds; StartTime: Wed May 22 18:01:15 2024; EndTime: Wed May 22 18:01:16 2024; Result: SUCCESS
2024-05-22 18:01:16,004 - DEBUG - Payload: {'id': 'c9f3f97a-7a43-4b25-8de1-fe69dddf3de1', 'command': 'deleteAccount', 'response': 'json', 'apiKey': 'TEYzt4GLXLz4859ncH84qCN84Lq6gQ0KIGWCz_xmchYBmESpqLobKaYV4lR1h2hMNyDWItpCJbYMcTPIZLQuow', 'signature': b'yBmWhvdwbBmVbGJZzWXUp/LQfa0='}
2024-05-22 18:01:16,004 - DEBUG - ========Sending GET Cmd : deleteAccount=======
2024-05-22 18:01:16,017 - DEBUG - === Jobid: 959c68af-38d7-449e-a2fa-dce97157ce42 Started ===
2024-05-22 18:01:16,018 - DEBUG - Payload: {'jobid': '959c68af-38d7-449e-a2fa-dce97157ce42', 'command': 'queryAsyncJobResult', 'response': 'json', 'apiKey': 'TEYzt4GLXLz4859ncH84qCN84Lq6gQ0KIGWCz_xmchYBmESpqLobKaYV4lR1h2hMNyDWItpCJbYMcTPIZLQuow', 'signature': b'XQMCPNQYvAIjl4oWX9uQe1mFC/k='}
2024-05-22 18:01:16,018 - DEBUG - ========Sending GET Cmd : queryAsyncJobResult=======
2024-05-22 18:01:16,032 - DEBUG - Response : {accountid : '0f27e443-8a09-11ee-b655-525400627401', userid : '0f29064e-8a09-11ee-b655-525400627401', cmd : 'org.apache.cloudstack.api.command.admin.account.DeleteAccountCmd', jobstatus : 0, jobprocstatus : 0, jobresultcode : 0, jobinstancetype : 'Account', jobinstanceid : 'c9f3f97a-7a43-4b25-8de1-fe69dddf3de1', created : '2024-05-22T18:01:16+0000', jobid : '959c68af-38d7-449e-a2fa-dce97157ce42'}
2024-05-22 18:01:17,034 - DEBUG - === JobId:959c68af-38d7-449e-a2fa-dce97157ce42 is Still Processing, Will TimeOut in:3599 ====
2024-05-22 18:01:17,034 - DEBUG - Payload: {'jobid': '959c68af-38d7-449e-a2fa-dce97157ce42', 'command': 'queryAsyncJobResult', 'response': 'json', 'apiKey': 'TEYzt4GLXLz4859ncH84qCN84Lq6gQ0KIGWCz_xmchYBmESpqLobKaYV4lR1h2hMNyDWItpCJbYMcTPIZLQuow', 'signature': b'XQMCPNQYvAIjl4oWX9uQe1mFC/k='}
2024-05-22 18:01:17,034 - DEBUG - ========Sending GET Cmd : queryAsyncJobResult=======
2024-05-22 18:01:17,055 - DEBUG - Response : {accountid : '0f27e443-8a09-11ee-b655-525400627401', userid : '0f29064e-8a09-11ee-b655-525400627401', cmd : 'org.apache.cloudstack.api.command.admin.account.DeleteAccountCmd', jobstatus : 1, jobprocstatus : 0, jobresultcode : 0, jobresulttype : 'object', jobresult : {success : True}, jobinstancetype : 'Account', jobinstanceid : 'c9f3f97a-7a43-4b25-8de1-fe69dddf3de1', created : '2024-05-22T18:01:16+0000', completed : '2024-05-22T18:01:16+0000', jobid : '959c68af-38d7-449e-a2fa-dce97157ce42'}
2024-05-22 18:01:17,055 - DEBUG - ===Jobid:959c68af-38d7-449e-a2fa-dce97157ce42 ; StartTime:Wed May 22 18:01:16 2024 ; EndTime:Wed May 22 18:01:17 2024 ; TotalTime:-1===
2024-05-22 18:01:17,056 - DEBUG - Response : {accountid : '0f27e443-8a09-11ee-b655-525400627401', userid : '0f29064e-8a09-11ee-b655-525400627401', cmd : 'org.apache.cloudstack.api.command.admin.account.DeleteAccountCmd', jobstatus : 1, jobprocstatus : 0, jobresultcode : 0, jobresulttype : 'object', jobresult : {success : True}, jobinstancetype : 'Account', jobinstanceid : 'c9f3f97a-7a43-4b25-8de1-fe69dddf3de1', created : '2024-05-22T18:01:16+0000', completed : '2024-05-22T18:01:16+0000', jobid : '959c68af-38d7-449e-a2fa-dce97157ce42'}
results
Test Quota balance ... === TestName: test_quota_balance | Status : SUCCESS ===
ok

----------------------------------------------------------------------
Ran 1 test in 2.658s

OK

@BryanMLima BryanMLima changed the base branch from 4.18 to 4.19 June 13, 2024 18:51
@BryanMLima BryanMLima force-pushed the fix-and-improve-quota-balance-calculation branch from d2d5ec1 to 38f9ddf Compare June 13, 2024 18:51
@BryanMLima BryanMLima modified the milestones: 4.18.3, 4.19.1.0 Jun 13, 2024
@BryanMLima
Copy link
Contributor Author

@sureshanaparti, do you think this PR can go to the 4.19.1.0 version?

@DaanHoogland
Copy link
Contributor

@BryanMLima , if @GutoVeronezi 's concerns are met, we can merge.

@BryanMLima
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

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

@blueorangutan
Copy link

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

@DaanHoogland
Copy link
Contributor

@blueorangutan test

@blueorangutan
Copy link

@DaanHoogland a [SL] Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

Copy link
Contributor

@GutoVeronezi GutoVeronezi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@blueorangutan
Copy link

[SF] Trillian test result (tid-10464)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 46019 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr8581-t10464-kvm-centos7.zip
Smoke tests completed. 129 look OK, 2 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_02_trigger_shutdown Failure 341.73 test_safe_shutdown.py
test_01_redundant_vpc_site2site_vpn Failure 431.74 test_vpc_vpn.py

@DaanHoogland DaanHoogland merged commit 7e71e50 into apache:4.19 Jun 18, 2024
24 of 26 checks passed
dhslove pushed a commit to ablecloud-team/ablestack-cloud that referenced this pull request Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

6 participants