-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Refactor type and range validation in configuration update process #9107
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
Conversation
f2e3757 to
91ca46c
Compare
|
@blueorangutan package |
|
@winterhazel 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. |
|
Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 9670 |
server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java
Outdated
Show resolved
Hide resolved
…gerImpl.java Co-authored-by: Henrique Sato <henriquesato2003@gmail.com>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9107 +/- ##
============================================
+ Coverage 15.57% 15.58% +0.01%
- Complexity 12051 12075 +24
============================================
Files 5505 5505
Lines 482738 482725 -13
Branches 61341 62781 +1440
============================================
+ Hits 75202 75251 +49
+ Misses 399227 399166 -61
+ Partials 8309 8308 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
|
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
|
@blueorangutan package |
|
@winterhazel 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. |
|
Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 10169 |
|
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
|
@blueorangutan package |
|
@winterhazel 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. |
|
Packaging result [SF]: ✖️ el7 ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 10226 |
|
@blueorangutan package |
|
@winterhazel 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. |
|
Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✖️ debian ✔️ suse15. SL-JID 10228 |
|
@blueorangutan package |
|
@winterhazel 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. |
|
[SF] Trillian Build Failed (tid-11061) |
server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java
Show resolved
Hide resolved
server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java
Show resolved
Hide resolved
hsato03
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.
LGTM. didn't test
|
Hey @winterhazel I did some testing, overall it looks good, but I've found one case that I think we should address in this PR.
Test 12 was sucessful, but the number informed is bigger than the maximum value of Floats and Doubles. Double.parseDouble() returns Infinity if the number being parsed would overflow. We should not allow this config value, we should return an error, like what is done in test 4. |
|
Thanks for testing @JoaoJandre. I addressed the issue you pointed out. |
|
@blueorangutan package |
|
@winterhazel 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. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 10764 |
|
@blueorangutan test |
|
@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
|
[SF] Trillian test result (tid-11158)
|
|
@blueorangutan test |
|
@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
|
[SF] Trillian Build Failed (tid-11181) |
JoaoJandre
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.
LGTM
|
@blueorangutan LLtest |
|
@DaanHoogland a [LL] Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
|
@blueorangutan package |
|
@winterhazel 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. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 10964 |
|
Merging based on approvals and manual testing #9107 (comment) |
…pache#9107) * Refactor type and range validation in configuration update process * Update server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java Co-authored-by: Henrique Sato <henriquesato2003@gmail.com> * Remove duplicate imports * Fix tests * Address Joao's reviews --------- Co-authored-by: Henrique Sato <henriquesato2003@gmail.com>
Description
The configuration update process mixes type validation with range validation in
com.cloud.configuration.ConfigurationManagerImpl#validateConfigurationValue. To improve this process, this PR splits these validations into two methods (validateValueTypeandvalidateValueRange) and cleans up the code.Furthermore, this PR also fixes an issue that allows non-numeric values to be inserted into
Doubleconfigurations, such aszone.virtualnetwork.ipv6subnet.capacity.notificationthreshold.Types of changes
Feature/Enhancement Scale or Bug Severity
Bug Severity
How Has This Been Tested?
I manually verified the behavior of trying to update configurations of the following types, and compared them with the previous version to ensure the result was expected:
String-quota.currency.symbolandalert.email.addresses(that is, one that does not havenullas a valid value and another that does);Boolean-admin.is.allowed.to.deploy.anywhere;Integer-storage.cleanup.interval. (the validations for this type also apply toShortandLong);Float-cpu.overprovisioning.factor(also applies toDouble)."null"in aStringthat does not havenullas a valid value"1"in aStringthat does not havenullas a valid value"1.1"in aStringthat does not havenullas a valid value"test"in aStringthat does not havenullas a valid value"null"in aStringthat hasnullas a valid value"1"in aStringthat hasnullas a valid value"1.1"in aStringthat hasnullas a valid value"test"in aStringthat hasnullas a valid value"null"in aBoolean"1"in aBoolean"1.1"in aBoolean"test"in aBoolean"true"in aBoolean"false"in aBoolean"fALse"in aBoolean"null"in anInteger"1"in anInteger"1.1"in anInteger"test"in anInteger"null"in aFloat"1"in aFloat"1.1"in aFloat"test"in aFloat