-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Inject hypervisor type and volume format on Quota tariffs #8138
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
Inject hypervisor type and volume format on Quota tariffs #8138
Conversation
DaanHoogland
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clgtm
|
@blueorangutan package |
|
@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. |
Codecov Report
@@ Coverage Diff @@
## main #8138 +/- ##
============================================
+ Coverage 28.15% 29.09% +0.93%
- Complexity 29181 30539 +1358
============================================
Files 5111 5111
Lines 360669 360696 +27
Branches 52700 52704 +4
============================================
+ Hits 101562 104935 +3373
+ Misses 245113 241331 -3782
- Partials 13994 14430 +436
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 252 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
GutoVeronezi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CLGTM
|
@blueorangutan test |
|
@DaanHoogland a [SL] Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
shwstppr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM
|
[SF] Trillian test result (tid-8095)
|
|
the gha failure is codecov upload. I don't think the ssvm errors are related. @shwstppr @GutoVeronezi Are we requiring 3rd party testing on this? |
It would be interesting to have 3rd party testing. |
I am not using quota, do you have a suggestion for who could test this, @GutoVeronezi ? |
@DaanHoogland, maybe @hsato03 could test it. |
thanks guys |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am sorry I could not test it before, guys.
I created an instance from a QCOW2 template using KVM and took a snapshot of it. Next, I created tariffs for RUNNING_VM, VOLUME and SNAPSHOT usage types and set the following activation rules:
RUNNING_VM
if (value.hypervisorType=='KVM') {
333
} else {
0
}VOLUME
if (value.volumeFormat=='QCOW2') {
444
} else {
0
}SNAPSHOT
if (value.hypervisorType=='KVM') {
555
} else {
0
}Then, I called the quotaUpdate API via CloudMonkey and checked that the script result was 333 for the for the RUNNING_VM tariff, 444 for the VOLUME tariff and 555 for the SNAPSHOT tariff. I also verified that the exception thrown while injecting the resourceType preset variable was fixed.
I don't think it is necessary but it would be interesting to have these new preset variables in TEMPLATE usage type tariffs as well.
Description
This PR adds two new preset variables into the Quota activation rules: hypervisor type and volume format. This allows operators to customize tariffs based on these two properties.
The respective preset variable will be injected into tariffs with the following usage types:
value.hypervisorType;value.hypervisorType;value.hypervisorType;value.hypervisorType;value.volumeFormat;value.volumeFormat.Example of an activation rule using
value.hypervisorType:Example of an activation rule using
value.volumeFormat:Furthermore, this PR also fixes the preset variable
resourceTypebeing injected into the JavaScript interpreter without quotes, which prevented the activation rules from executing.Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
I created two tariffs through CloudMonkey:
Then, I deployed a virtual machine using KVM, called
quotaUpdateand verified through the logs that that the calculated value was 1 for the first tariff and 3 for the second.