Skip to content

[Usage] Create network billing - #7236

Merged
DaanHoogland merged 15 commits into
apache:4.19from
scclouds:usage-network-billing
Apr 24, 2024
Merged

[Usage] Create network billing#7236
DaanHoogland merged 15 commits into
apache:4.19from
scclouds:usage-network-billing

Conversation

@SadiJr

Copy link
Copy Markdown
Contributor

Description

The usage of networks is not captured and saved by the Usage plugin, which makes it impossible to charge via the Quota plugin. The Usage plugin has been updated to record network events in the database. When a network is created, the event EVENT_NETWORK_CREATE is used; when a network is removed, the event EVENT_NETWORK_DELETE is used; and when a network is updated, the event EVENT_NETWORK_UPDATE is used. Also, this new type has the attributes value.state, value.id and value.name injected in the Quota plugin.

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

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

It was tested in a local lab:

  1. I created and destroyed networks via UI;
  2. Previously, ACS did not save any network events in Usage;
  3. Now, ACS saves these events in Usage.

@codecov

codecovBot commented Feb 15, 2023

Copy link
Copy Markdown

Codecov Report

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

Project coverage is 29.90%. Comparing base (ffd5972) to head (2d9f0c4).
Report is 11 commits behind head on 4.19.

FilesPatch %Lines
...java/com/cloud/usage/dao/UsageNetworksDaoImpl.java3.03%64 Missing ⚠️
...src/main/java/com/cloud/usage/UsageNetworksVO.java7.31%38 Missing ⚠️
...va/com/cloud/usage/parser/NetworksUsageParser.java0.00%37 Missing ⚠️
...rc/main/java/com/cloud/usage/UsageManagerImpl.java0.00%16 Missing ⚠️
...tionrule/presetvariables/PresetVariableHelper.java8.33%11 Missing ⚠️
.../schema/src/main/java/com/cloud/usage/UsageVO.java0.00%3 Missing ⚠️
api/src/main/java/com/cloud/event/EventTypes.java0.00%2 Missing ⚠️
...ck/quota/activationrule/presetvariables/Value.java75.00%1 Missing ⚠️
...ain/java/com/cloud/network/NetworkServiceImpl.java88.88%0 Missing and 1 partial ⚠️
Additional details and impacted files
@@ Coverage Diff @@## 4.19 #7236 +/- ##
============================================
- Coverage 30.96% 29.90% -1.06% + Complexity 34304 33070 -1234 
============================================
Files 5354 5359 +5 Lines 376105 376883 +778 Branches 54694 54833 +139 ============================================
- Hits 116454 112716 -3738 - Misses 244336 249277 +4941 + Partials 15315 14890 -425 
FlagCoverage Δ
simulator-marvin-tests23.36% <10.05%> (-1.45%)⬇️
uitests4.38% <ø> (-0.01%)⬇️
unit-tests16.56% <3.01%> (-0.03%)⬇️

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.

@github-actions

Copy link
Copy Markdown

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

@sonarqubecloud

Copy link
Copy Markdown

@stephankrugggstephankruggg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

CLGTM, not manually tested

@DaanHoogland

Copy link
Copy Markdown
Contributor

SonarCloud Quality Gate failed. Quality Gate failed

BugA0 BugsVulnerabilityA0 VulnerabilitiesSecurity HotspotA0 Security HotspotsCode SmellA10 Code Smells

1.4%1.4% Coverage3.1%3.1% Duplication

@SadiJr 4 of those 10 code smells look more serious, can you look at those. I will review this later.

@github-actions

Copy link
Copy Markdown

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

@kiranchavala

Copy link
Copy Markdown
Member

@SadiJr Could you please resolve the merge conflicts

@sonarqubecloud

Copy link
Copy Markdown

@DaanHoogland

Copy link
Copy Markdown
Contributor

@SadiJr for this one as well, we have to decide what to base this on and correct the upgrade path accordingly.

@DaanHooglandDaanHoogland added this to the 4.19.0.0 milestone Jun 22, 2023
Comment threadengine/schema/src/main/resources/META-INF/db/schema-41810to41900.sql Outdated
DELETE FROM `cloud`.`snapshot_store_ref`
WHERE store_role = "Primary" AND store_id IN (SELECT id FROM storage_pool WHERE removed IS NOT NULL);


Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

maybe undo this delete?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@DaanHoogland I think the file indentation is better by removing this line.

@github-actions

Copy link
Copy Markdown

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

BryanMLimaand others added 2 commits April 23, 2024 14:11
Co-authored-by: Henrique Sato <henriquesato2003@gmail.com>
@apacheapache deleted a comment from kiranchavalaApr 24, 2024
@apacheapache deleted a comment from blueorangutanApr 24, 2024
@apacheapache deleted a comment from blueorangutanApr 24, 2024
@apacheapache deleted a comment from blueorangutanApr 24, 2024
@apacheapache deleted a comment from blueorangutanApr 24, 2024
@apacheapache deleted a comment from blueorangutanApr 24, 2024
@apacheapache deleted a comment from blueorangutanApr 24, 2024
@apacheapache deleted a comment from blueorangutanApr 24, 2024
@apacheapache deleted a comment from blueorangutanApr 24, 2024
@apacheapache deleted a comment from blueorangutanApr 24, 2024
@apacheapache deleted a comment from blueorangutanApr 24, 2024
@apacheapache deleted a comment from blueorangutanApr 24, 2024
@apacheapache deleted a comment from BryanMLimaApr 24, 2024
@apacheapache deleted a comment from blueorangutanApr 24, 2024
@apacheapache deleted a comment from blueorangutanApr 24, 2024
@apacheapache deleted a comment from blueorangutanApr 24, 2024
@apacheapache deleted a comment from blueorangutanApr 24, 2024
@apacheapache deleted a comment from BryanMLimaApr 24, 2024
@apacheapache deleted a comment from blueorangutanApr 24, 2024
@apacheapache deleted a comment from blueorangutanApr 24, 2024
@apacheapache deleted a comment from blueorangutanApr 24, 2024
@apacheapache deleted a comment from blueorangutanApr 24, 2024
@apacheapache deleted a comment from blueorangutanApr 24, 2024
@apacheapache deleted a comment from BryanMLimaApr 24, 2024
@apacheapache deleted a comment from blueorangutanApr 24, 2024
@apacheapache deleted a comment from blueorangutanApr 24, 2024
@apacheapache deleted a comment from blueorangutanApr 24, 2024
@DaanHoogland

Copy link
Copy Markdown
Contributor

This looks good to everyone. merging

Sign up for freeto 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.

12 participants

@SadiJr@DaanHoogland@kiranchavala@BryanMLima@sureshanaparti@blueorangutan@codecov-commenter@GutoVeronezi@hsato03@JoaoJandre@stephankruggg@shwstppr