Skip to content

Conversation

@lucas-a-martins
Copy link
Collaborator

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

@codecov
Copy link

codecov bot commented Aug 12, 2024

Codecov Report

Attention: Patch coverage is 92.00000% with 4 lines in your changes missing coverage. Please review.

Project coverage is 16.06%. Comparing base (91ab67c) to head (e059631).
Report is 165 commits behind head on main.

Files with missing lines Patch % Lines
.../org/apache/cloudstack/quota/QuotaManagerImpl.java 33.33% 1 Missing and 1 partial ⚠️
...tionrule/presetvariables/PresetVariableHelper.java 92.30% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               main    #9500   +/-   ##
=========================================
  Coverage     16.06%   16.06%           
- Complexity    12864    12874   +10     
=========================================
  Files          5642     5643    +1     
  Lines        493856   493904   +48     
  Branches      59860    59863    +3     
=========================================
+ Hits          79326    79370   +44     
- Misses       405749   405751    +2     
- Partials       8781     8783    +2     
Flag Coverage Δ
uitests 4.02% <ø> (ø)
unittests 16.91% <92.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.

Co-authored-by: Fabricio Duarte <[email protected]>
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.

clgtm

@DaanHoogland
Copy link
Contributor

there is a build error @lucas-a-martins , please have a look.

Copy link
Member

@winterhazel winterhazel left a comment

Choose a reason for hiding this comment

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

Looks good, just need to fix the build.

I debugged the code to see what values were injected into value.computeOffering.offerHa and value.configuration.forceHa on different scenarios, and verified that they had the expected value.

  • value.computeOffering.offerHa:

    • false when the offering does not offer HA
    • true when the offering offers HA
  • configuration.forceHa

    • true when force.ha is set to true on cluster-level
    • false when force.ha is set to false on cluster-level
    • true when not set on cluster-level, but the global setting is set to true
    • false when not set on cluster-level, but the global setting is set to false

@lucas-a-martins
Copy link
Collaborator Author

lucas-a-martins commented Nov 19, 2024

there is a build error @lucas-a-martins , please have a look.

@DaanHoogland
Fixed, it was missing an import haha

@github-actions
Copy link

github-actions bot commented Dec 4, 2024

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

@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]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 11811

@DaanHoogland
Copy link
Contributor

@blueorangutan test

@blueorangutan
Copy link

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

@blueorangutan
Copy link

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

Test Result Time (s) Test File
test_02_unsecure_vm_migration Error 448.39 test_vm_life_cycle.py
test_03_secured_to_nonsecured_vm_migration Error 357.29 test_vm_life_cycle.py

@lucas-a-martins
Copy link
Collaborator Author

[SF] Trillian test result (tid-11907) Environment: kvm-ol8 (x2), Advanced Networking with Mgmt server ol8 Total time taken: 52891 seconds Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr9500-t11907-kvm-ol8.zip Smoke tests completed. 140 look OK, 1 have errors, 0 did not run Only failed and skipped tests results shown below:
Test Result Time (s) Test File
test_02_unsecure_vm_migration Error 448.39 test_vm_life_cycle.py
test_03_secured_to_nonsecured_vm_migration Error 357.29 test_vm_life_cycle.py

I checked the test errors and both are unrelated with the PR

@JoaoJandre JoaoJandre merged commit 617fee8 into apache:main Feb 14, 2025
26 checks passed
dhslove pushed a commit to ablecloud-team/ablestack-cloud that referenced this pull request Jun 19, 2025
…pe (apache#9500)

* Add offerHA and forceHa presets to Running VM

* apply winterhazel's suggestion

Co-authored-by: Fabricio Duarte <[email protected]>

* Add ObjectUtils import

---------

Co-authored-by: Lucas Martins <[email protected]>
Co-authored-by: Fabricio Duarte <[email protected]>
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.

5 participants