cloudstack icon indicating copy to clipboard operation
cloudstack copied to clipboard

Consider Quota settings during processing

Open julien-vaz opened this issue 7 months ago • 4 comments

Consider Quota settings during processing

Description

Currently, when using the Quota plugin, it is possible to enable/disable the plugin specifically in the account settings. However, even if the plugin is disabled for the account, the setting is not considered because the Quota manager is failing to get its value, so that the account's Quota balance is always processed. This PR fixes this behavior.

Types of changes

  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [ ] New feature (non-breaking change which adds functionality)
  • [x] 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
  • [ ] test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Bug Severity

  • [ ] BLOCKER
  • [ ] Critical
  • [ ] Major
  • [x] Minor
  • [ ] Trivial

Screenshots (if appropriate):

How Has This Been Tested?

  1. A account was created and, before the Usage job was run, the Quota plugin was disabled for the account. It was attested via GUI and logs that the account didn't appear in Quota and it wasn't even processed.
  2. Another account was created with the Quota plugin enabled. After the Usage job was run once and the Quota was processed for the account, the Quota plugin was disabled and on the second run it was attested that the credit was not decremented.

julien-vaz avatar May 19 '25 14:05 julien-vaz

Codecov Report

:x: Patch coverage is 4.00000% with 24 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 16.57%. Comparing base (0934fb1) to head (617d232). :warning: Report is 603 commits behind head on main.

Files with missing lines Patch % Lines
.../org/apache/cloudstack/quota/QuotaManagerImpl.java 0.00% 24 Missing :warning:
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #10892      +/-   ##
============================================
+ Coverage     16.30%   16.57%   +0.26%     
- Complexity    13450    13867     +417     
============================================
  Files          5675     5719      +44     
  Lines        499249   507216    +7967     
  Branches      60377    61577    +1200     
============================================
+ Hits          81425    84088    +2663     
- Misses       408753   413709    +4956     
- Partials       9071     9419     +348     
Flag Coverage Δ
uitests 3.96% <ø> (-0.03%) :arrow_down:
unittests 17.45% <4.00%> (+0.28%) :arrow_up:

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

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar May 20 '25 07:05 codecov[bot]

@blueorangutan package

JoaoJandre avatar Jun 02 '25 20:06 JoaoJandre

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

blueorangutan avatar Jun 02 '25 20:06 blueorangutan

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

blueorangutan avatar Jun 02 '25 21:06 blueorangutan

@blueorangutan package

DaanHoogland avatar Jul 16 '25 06:07 DaanHoogland

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

blueorangutan avatar Jul 16 '25 06:07 blueorangutan

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

blueorangutan avatar Jul 16 '25 07:07 blueorangutan

@blueorangutan test

DaanHoogland avatar Jul 16 '25 09:07 DaanHoogland

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

blueorangutan avatar Jul 16 '25 09:07 blueorangutan

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

Test Result Time (s) Test File

blueorangutan avatar Jul 17 '25 01:07 blueorangutan

As far as I understand this might be a generic problem, ie, ConfigKey.valueIn(accountId) not returning domain-level value when the config enable.account.settings.for.domain is set to true. And a change should be added at the ConfigKey level itself. Also, it will be worth checking if the behaviour has been fixed by 2a4a1f7 as Domain is considered PArent scope for Account scope now.

if we call valueinscope() method, will it work @shwstppr ?

harikrishna-patnala avatar Sep 23 '25 06:09 harikrishna-patnala

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

github-actions[bot] avatar Oct 16 '25 09:10 github-actions[bot]