Skip to content

Quota tariff events#8030

Merged
DaanHoogland merged 5 commits intoapache:4.18from
scclouds:quota-tariff-events
Mar 6, 2024
Merged

Quota tariff events#8030
DaanHoogland merged 5 commits intoapache:4.18from
scclouds:quota-tariff-events

Conversation

@hsato03
Copy link
Member

@hsato03 hsato03 commented Oct 3, 2023

Description

While creating, updating or removing a quota tariff there are no events for any of these actions.

To address that, every time a quota tariff is created, updated or removed, a new event is created containing some details of these operations.

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)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

I created, updated and removed a quota tariff. Then I accessed the Events tab and all the operations were there.

Copy link
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

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

code looks good

@codecov
Copy link

codecov bot commented Oct 4, 2023

Codecov Report

Attention: Patch coverage is 15.38462% with 11 lines in your changes are missing coverage. Please review.

Project coverage is 13.17%. Comparing base (d8cd122) to head (3aea1c9).
Report is 13 commits behind head on 4.18.

Files Patch % Lines
...udstack/api/response/QuotaResponseBuilderImpl.java 20.00% 4 Missing ⚠️
...pache/cloudstack/quota/dao/QuotaTariffDaoImpl.java 0.00% 2 Missing ⚠️
...e/cloudstack/api/command/QuotaTariffCreateCmd.java 0.00% 2 Missing ⚠️
...e/cloudstack/api/command/QuotaTariffDeleteCmd.java 0.00% 2 Missing ⚠️
...e/cloudstack/api/command/QuotaTariffUpdateCmd.java 50.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               4.18    #8030      +/-   ##
============================================
+ Coverage     13.16%   13.17%   +0.01%     
- Complexity     9199     9207       +8     
============================================
  Files          2724     2724              
  Lines        258109   258149      +40     
  Branches      40228    40235       +7     
============================================
+ Hits          33970    34003      +33     
  Misses       219837   219837              
- Partials       4302     4309       +7     

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

@DaanHoogland
Copy link
Contributor

@blueorangutan package

Copy link
Member

@harikrishna-patnala harikrishna-patnala left a comment

Choose a reason for hiding this comment

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

Code LGTM


@Override
public void execute() {
CallContext.current().setEventDetails(String.format("Tariff: %s, description: %s, value: %s", getName(), getDescription(), getValue()));
Copy link
Member

Choose a reason for hiding this comment

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

IMO, It would be better to override getApiResourceType() & getApiResourceId() methods. This would also link the events with the quota resources.

@harikrishna-patnala @DaanHoogland What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you mean to add the fields resource_type and resource_id to the quota_tariffs table and set and return those values?
As tarriffs can change and need to keep historic data, I am not sure, but it might work. @GutoVeronezi can you chime in?

Copy link
Member

Choose a reason for hiding this comment

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

No. I meant for Quota resource itself. Here is the javadoc for getApiResourceId() method.
This will require adding a key ApiCommandResourceType.java as well.

/**
     * Commands that generate action events associated to a resource and
     * async commands that want to be tracked as part of the listXXX commands
     * need to provide implementations of the two following methods,
     * getApiResourceId() and getApiResourceType()
     *
     * getApiResourceId() should return the id of the object the async command is executing on
     * getApiResourceType() should return a type from the ApiCommandResourceType enumeration
     */

As per my understanding, this will add a link in UI for events view. And allows to filter events per resource type & resource id which is quota in this case.
image

Copy link
Contributor

Choose a reason for hiding this comment

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

@hsato03 can you have a look at this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hi @vishesh92 @DaanHoogland,

I made the changes to allow users filter quota tariff events in UI. Could you guys take a look?

@DaanHoogland
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

@DaanHoogland a [SF] 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 7292

@DaanHoogland
Copy link
Contributor

@blueorangutan test

@blueorangutan
Copy link

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

@github-actions
Copy link

github-actions bot commented Dec 1, 2023

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

@vishesh92
Copy link
Member

@blueorangutan package

@blueorangutan
Copy link

@vishesh92 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 8245

@DaanHoogland
Copy link
Contributor

@blueorangutan package

@DaanHoogland
Copy link
Contributor

@hsato03 are we targeting 20 with this PR (cc @JoaoJandre )?

@hsato03
Copy link
Member Author

hsato03 commented Feb 6, 2024

@DaanHoogland @JoaoJandre Maybe we can target it to the 4.18.2. What do you think?

@vishesh92
Copy link
Member

@blueorangutan package

@blueorangutan
Copy link

@vishesh92 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 8555

@vishesh92
Copy link
Member

@blueorangutan test

@DaanHoogland
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

@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
Copy link

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

@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

@blueorangutan
Copy link

[SF] Trillian test result (tid-9189)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 40247 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr8030-t9189-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
Copy link
Contributor

@hsato03 I think this needs testing but as you guys are the only heavy users of quota, can you find one of your colleagues to verify this, please?

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.

CLGTM

I'll try to test it in the next days.

@GutoVeronezi
Copy link
Contributor

@hsato03, the events are being created correctly and the filter in the UI is working. However, the resource column is empty; it should present the tariff's name.

image

@hsato03
Copy link
Member Author

hsato03 commented Feb 28, 2024

@hsato03, the events are being created correctly and the filter in the UI is working. However, the resource column is empty; it should present the tariff's name.

image

Thanks.

I addressed this in the last commit. Could you take a look again?

Screenshot from 2024-02-28 15-14-25

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.

CLGTM

@GutoVeronezi
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

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

@GutoVeronezi
Copy link
Contributor

@DaanHoogland @JoaoJandre

I think one more round of tests is needed (just for sanity); aside that, I think this one is good to go.

@blueorangutan
Copy link

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

@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

@blueorangutan
Copy link

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

Test Result Time (s) Test File
test_08_migrate_vm Error 0.06 test_vm_life_cycle.py

@DaanHoogland DaanHoogland merged commit 223a9b8 into apache:4.18 Mar 6, 2024
dhslove pushed a commit to ablecloud-team/ablestack-cloud that referenced this pull request Mar 21, 2024
Co-authored-by: Henrique Sato <henrique.sato@scclouds.com.br>
@DaanHoogland DaanHoogland added this to the 4.19.1.0 milestone Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants