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

Add offerHa and forceHa preset variables to RUNNING_VM usage type #9500

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lucas-a-martins
Copy link
Contributor

Description

This PR adds the following preset variables to the usage type RUNNING_VM:

value.computeOffering.offerHa: A boolean informing if the compute offering offers HA or not.

configuration.forceHa: A boolean informing if the cluster configuration force.ha is enabled or not. Considering that force.ha is a configuration at cluster scope, the priority is to get the value from the cluster. If no value is specified in the cluster scope, the variable will use the global settings value.

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
  • test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Screenshots (if appropriate):

offerHa

How Has This Been Tested?

To test the offerHa variable, I created a VM using a compute offering where offerHa=true and the following tariff. As shown in the first screenshot above, the tariff was applied as expected.

"activationRule": "value.computeOffering.offerHa",
"currency": "$",
"effectiveDate": "2024-08-05T20:35:26+0000",
"id": "d8826c40-2063-4ceb-b377-b05cb8b72b6e",
"name": "offerHa",
"position": 1,
"tariffValue": 30000,
"usageDiscriminator": "None",
"usageName": "RUNNING_VM",
"usageType": 1,
"usageTypeDescription": "Running Vm Usage",
"usageUnit": "Compute*Month"

Then, I tested the forceHa variable by using the following tariff:

"activationRule": "configuration.forceHa",
"currency": "$",
"effectiveDate": "2024-08-05T19:25:17+0000",
"id": "023d4562-7465-445c-afa7-cc356564ad98",
"name": "forceHa",
"position": 1,
"tariffValue": 22222,
"usageDiscriminator": "None",
"usageName": "RUNNING_VM",
"usageType": 1,
"usageTypeDescription": "Running Vm Usage",
"usageUnit": "Compute*Month"

These are the results of my tests by changing the force.ha values in both the cluster and global settings:

Cluster Global settings Tariff applied
default true Yes
true false Yes
false true No
default false No

Copy link

codecov bot commented Aug 12, 2024

Codecov Report

Attention: Patch coverage is 90.00000% with 5 lines in your changes missing coverage. Please review.

Project coverage is 15.55%. Comparing base (cd8442a) to head (96a5458).
Report is 18 commits behind head on main.

Files Patch % Lines
...tionrule/presetvariables/PresetVariableHelper.java 88.46% 1 Missing and 2 partials ⚠️
.../org/apache/cloudstack/quota/QuotaManagerImpl.java 33.33% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##               main    #9500     +/-   ##
===========================================
  Coverage     15.54%   15.55%             
- Complexity    11976    12005     +29     
===========================================
  Files          5495     5497      +2     
  Lines        481076   481554    +478     
  Branches      62235    60230   -2005     
===========================================
+ Hits          74785    74898    +113     
- Misses       398028   398367    +339     
- Partials       8263     8289     +26     
Flag Coverage Δ
uitests 4.18% <ø> (-0.03%) ⬇️
unittests 16.32% <90.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.

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.

1 participant