lucas-a-martins opened a new pull request, #9500:
URL: https://github.com/apache/cloudstack/pull/9500

   ### 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)
   - [x] 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
   - [x] Minor
   
   
   ### Screenshots (if appropriate):
   
   
![offerHa](https://github.com/user-attachments/assets/57e12090-18dd-4b37-9886-c8bf8b0c1ab7)
   
   ### 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** |


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to