You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2020/10/06 07:23:35 UTC

[GitHub] [cloudstack] ustcweizhou opened a new pull request #4376: server: Fix some cpuspeed issues while create service offering

ustcweizhou opened a new pull request #4376:
URL: https://github.com/apache/cloudstack/pull/4376


   Only the following offerings are accepted
   
   (1) fixed offering:
   cpunumber, memory, must be specified.
   cpuspeed should be specified
   
   example: create serviceoffering displaytext=offering-fix name=offering-fix cpunumber=1 memory=1024 cpuspeed=1000
   
   (should not work)
   create serviceoffering displaytext=offering-fix name=offering-fix cpunumber=1 memory=1024 (but works in 4.14, fixed by this commit)
   
   (2) unconstrained offering:
   
   cpunumber, memory must be null
   cpuspeed must be null
   
   example: create serviceoffering displaytext=offering-unconstrained name=offering-unconstrained
   
   (should not work)
   create serviceoffering displaytext=offering-unconstrained name=offering-unconstrained cpunumber=1
   create serviceoffering displaytext=offering-unconstrained name=offering-unconstrained memory=1024
   create serviceoffering displaytext=offering-unconstrained name=offering-unconstrained cpuspeed=1000 (but works in 4.14, fixed by this commit)
   
   (3) constrained offering:
   
   cpunumber, memory must be null
   mincpunumber, maxcpunumber, minmemory, maxmemory, cpuspeed must be specified
   
   example:create serviceoffering displaytext=offering-constrained name=offering-constrained mincpunumber=1 maxcpunumber=2 minmemory=1024 maxmemory=2048 cpuspeed=1000
   
   (should not work)
   create serviceoffering displaytext=offering-constrained name=offering-constrained mincpunumber=1 maxcpunumber=2 minmemory=1024 maxmemory=2048 (but works in 4.14, fixed by this commit)
   
   ## Description
   <!--- Describe your changes in detail -->
   
   <!-- For new features, provide link to FS, dev ML discussion etc. -->
   <!-- In case of bug fix, the expected and actual behaviours, steps to reproduce. -->
   
   <!-- When "Fixes: #<id>" is specified, the issue/PR will automatically be closed when this PR gets merged -->
   <!-- For addressing multiple issues/PRs, use multiple "Fixes: #<id>" -->
   <!-- Fixes: # -->
   
   ## Types of changes
   <!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
   - [ ] 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)
   
   ## Screenshots (if appropriate):
   
   ## How Has This Been Tested?
   <!-- Please describe in detail how you tested your changes. -->
   <!-- Include details of your testing environment, and the tests you ran to -->
   <!-- see how your change affects other areas of the code, etc. -->
   
   
   <!-- Please read the [CONTRIBUTING](https://github.com/apache/cloudstack/blob/master/CONTRIBUTING.md) document -->
   


----------------------------------------------------------------
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.

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



[GitHub] [cloudstack] sureshanaparti commented on a change in pull request #4376: server: Fix some cpuspeed issues while create service offering

Posted by GitBox <gi...@apache.org>.
sureshanaparti commented on a change in pull request #4376:
URL: https://github.com/apache/cloudstack/pull/4376#discussion_r503437058



##########
File path: server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java
##########
@@ -2343,7 +2343,7 @@ public ServiceOffering createServiceOffering(final CreateServiceOfferingCmd cmd)
             if (cpuNumber != null && (cpuNumber.intValue() <= 0 || cpuNumber.longValue() > Integer.MAX_VALUE)) {
                 throw new InvalidParameterValueException("Failed to create service offering " + offeringName + ": specify the cpu number value between 1 and " + Integer.MAX_VALUE);
             }
-            if (cpuSpeed != null && (cpuSpeed.intValue() < 0 || cpuSpeed.longValue() > Integer.MAX_VALUE)) {
+            if (cpuSpeed == null || (cpuSpeed.intValue() < 0 || cpuSpeed.longValue() > Integer.MAX_VALUE)) {

Review comment:
       @weizhouapache thanks for confirming




----------------------------------------------------------------
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.

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



[GitHub] [cloudstack] DaanHoogland commented on pull request #4376: server: Fix some cpuspeed issues while create service offering

Posted by GitBox <gi...@apache.org>.
DaanHoogland commented on pull request #4376:
URL: https://github.com/apache/cloudstack/pull/4376#issuecomment-704245368


   @blueorangutan test


----------------------------------------------------------------
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.

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



[GitHub] [cloudstack] sureshanaparti commented on a change in pull request #4376: server: Fix some cpuspeed issues while create service offering

Posted by GitBox <gi...@apache.org>.
sureshanaparti commented on a change in pull request #4376:
URL: https://github.com/apache/cloudstack/pull/4376#discussion_r502235288



##########
File path: server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java
##########
@@ -2319,9 +2319,9 @@ public ServiceOffering createServiceOffering(final CreateServiceOfferingCmd cmd)
                 throw new InvalidParameterValueException("For creating a custom compute offering cpu and memory all should be null");
             }
             // if any of them is null, then all of them shoull be null
-            if (maxCPU == null || minCPU == null || maxMemory == null || minMemory == null) {
-                if (maxCPU != null || minCPU != null || maxMemory != null || minMemory != null) {
-                    throw new InvalidParameterValueException("For creating a custom compute offering min/max cpu and min/max memory should all be specified");
+            if (maxCPU == null || minCPU == null || maxMemory == null || minMemory == null || cpuSpeed == null) {
+                if (maxCPU != null || minCPU != null || maxMemory != null || minMemory != null || cpuSpeed != null) {
+                    throw new InvalidParameterValueException("For creating a custom compute offering min/max cpu and min/max memory/cpu speed should all be null or all specified");
                 }
             } else {
                 if (cpuSpeed != null && (cpuSpeed.intValue() < 0 || cpuSpeed.longValue() > Integer.MAX_VALUE)) {

Review comment:
       `cpuSpeed` null check not required here, it is always not null as per the above changes.

##########
File path: server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java
##########
@@ -2343,7 +2343,7 @@ public ServiceOffering createServiceOffering(final CreateServiceOfferingCmd cmd)
             if (cpuNumber != null && (cpuNumber.intValue() <= 0 || cpuNumber.longValue() > Integer.MAX_VALUE)) {
                 throw new InvalidParameterValueException("Failed to create service offering " + offeringName + ": specify the cpu number value between 1 and " + Integer.MAX_VALUE);
             }
-            if (cpuSpeed != null && (cpuSpeed.intValue() < 0 || cpuSpeed.longValue() > Integer.MAX_VALUE)) {
+            if (cpuSpeed == null || (cpuSpeed.intValue() < 0 || cpuSpeed.longValue() > Integer.MAX_VALUE)) {

Review comment:
       @ustcweizhou similar cond check applicable for `cpuNumber` and `memory` if these are mandatory params? check and update accordingly.




----------------------------------------------------------------
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.

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



[GitHub] [cloudstack] blueorangutan commented on pull request #4376: server: Fix some cpuspeed issues while create service offering

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4376:
URL: https://github.com/apache/cloudstack/pull/4376#issuecomment-704200093


   @DaanHoogland a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.


----------------------------------------------------------------
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.

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



[GitHub] [cloudstack] blueorangutan commented on pull request #4376: server: Fix some cpuspeed issues while create service offering

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4376:
URL: https://github.com/apache/cloudstack/pull/4376#issuecomment-704245633


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


----------------------------------------------------------------
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.

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



[GitHub] [cloudstack] blueorangutan commented on pull request #4376: server: Fix some cpuspeed issues while create service offering

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4376:
URL: https://github.com/apache/cloudstack/pull/4376#issuecomment-704237294


   Packaging result: ✔centos7 ✖centos8 ✔debian. JID-2127


----------------------------------------------------------------
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.

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



[GitHub] [cloudstack] blueorangutan commented on pull request #4376: server: Fix some cpuspeed issues while create service offering

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4376:
URL: https://github.com/apache/cloudstack/pull/4376#issuecomment-704572354


   <b>Trillian test result (tid-2899)</b>
   Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
   Total time taken: 30521 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr4376-t2899-kvm-centos7.zip
   Smoke tests completed. 83 look OK, 0 have error(s)
   Only failed tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   


----------------------------------------------------------------
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.

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



[GitHub] [cloudstack] DaanHoogland merged pull request #4376: server: Fix some cpuspeed issues while create service offering

Posted by GitBox <gi...@apache.org>.
DaanHoogland merged pull request #4376:
URL: https://github.com/apache/cloudstack/pull/4376


   


----------------------------------------------------------------
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.

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



[GitHub] [cloudstack] DaanHoogland commented on pull request #4376: server: Fix some cpuspeed issues while create service offering

Posted by GitBox <gi...@apache.org>.
DaanHoogland commented on pull request #4376:
URL: https://github.com/apache/cloudstack/pull/4376#issuecomment-704199844


   @blueorangutan package


----------------------------------------------------------------
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.

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



[GitHub] [cloudstack] sureshanaparti commented on a change in pull request #4376: server: Fix some cpuspeed issues while create service offering

Posted by GitBox <gi...@apache.org>.
sureshanaparti commented on a change in pull request #4376:
URL: https://github.com/apache/cloudstack/pull/4376#discussion_r502238669



##########
File path: server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java
##########
@@ -2343,7 +2343,7 @@ public ServiceOffering createServiceOffering(final CreateServiceOfferingCmd cmd)
             if (cpuNumber != null && (cpuNumber.intValue() <= 0 || cpuNumber.longValue() > Integer.MAX_VALUE)) {
                 throw new InvalidParameterValueException("Failed to create service offering " + offeringName + ": specify the cpu number value between 1 and " + Integer.MAX_VALUE);
             }
-            if (cpuSpeed != null && (cpuSpeed.intValue() < 0 || cpuSpeed.longValue() > Integer.MAX_VALUE)) {
+            if (cpuSpeed == null || (cpuSpeed.intValue() < 0 || cpuSpeed.longValue() > Integer.MAX_VALUE)) {

Review comment:
       @ustcweizhou similar cond check applicable for `cpuNumber` and `memory` if these are mandatory params? check and update accordingly.




----------------------------------------------------------------
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.

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



[GitHub] [cloudstack] weizhouapache commented on a change in pull request #4376: server: Fix some cpuspeed issues while create service offering

Posted by GitBox <gi...@apache.org>.
weizhouapache commented on a change in pull request #4376:
URL: https://github.com/apache/cloudstack/pull/4376#discussion_r502630493



##########
File path: server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java
##########
@@ -2343,7 +2343,7 @@ public ServiceOffering createServiceOffering(final CreateServiceOfferingCmd cmd)
             if (cpuNumber != null && (cpuNumber.intValue() <= 0 || cpuNumber.longValue() > Integer.MAX_VALUE)) {
                 throw new InvalidParameterValueException("Failed to create service offering " + offeringName + ": specify the cpu number value between 1 and " + Integer.MAX_VALUE);
             }
-            if (cpuSpeed != null && (cpuSpeed.intValue() < 0 || cpuSpeed.longValue() > Integer.MAX_VALUE)) {
+            if (cpuSpeed == null || (cpuSpeed.intValue() < 0 || cpuSpeed.longValue() > Integer.MAX_VALUE)) {

Review comment:
       @sureshanaparti cpuNumber and memory are not mandatory for dynamic offerings.
   There are 3 types of offerings
   (1) fixed offering, cpu number, cpu speed, memory are mandatory
   (2) dynamic offering, 
   (2.1) unconstrained offering, cpu number, cpu speed, memory are not required
   (2.2) constrained offerings, min/max cpu, min/max memory, and cpu speed are mandatory.




----------------------------------------------------------------
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.

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



[GitHub] [cloudstack] sureshanaparti commented on a change in pull request #4376: server: Fix some cpuspeed issues while create service offering

Posted by GitBox <gi...@apache.org>.
sureshanaparti commented on a change in pull request #4376:
URL: https://github.com/apache/cloudstack/pull/4376#discussion_r502235288



##########
File path: server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java
##########
@@ -2319,9 +2319,9 @@ public ServiceOffering createServiceOffering(final CreateServiceOfferingCmd cmd)
                 throw new InvalidParameterValueException("For creating a custom compute offering cpu and memory all should be null");
             }
             // if any of them is null, then all of them shoull be null
-            if (maxCPU == null || minCPU == null || maxMemory == null || minMemory == null) {
-                if (maxCPU != null || minCPU != null || maxMemory != null || minMemory != null) {
-                    throw new InvalidParameterValueException("For creating a custom compute offering min/max cpu and min/max memory should all be specified");
+            if (maxCPU == null || minCPU == null || maxMemory == null || minMemory == null || cpuSpeed == null) {
+                if (maxCPU != null || minCPU != null || maxMemory != null || minMemory != null || cpuSpeed != null) {
+                    throw new InvalidParameterValueException("For creating a custom compute offering min/max cpu and min/max memory/cpu speed should all be null or all specified");
                 }
             } else {
                 if (cpuSpeed != null && (cpuSpeed.intValue() < 0 || cpuSpeed.longValue() > Integer.MAX_VALUE)) {

Review comment:
       `cpuSpeed` null check not required here, it is always not null as per the above changes.




----------------------------------------------------------------
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.

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



[GitHub] [cloudstack] weizhouapache commented on a change in pull request #4376: server: Fix some cpuspeed issues while create service offering

Posted by GitBox <gi...@apache.org>.
weizhouapache commented on a change in pull request #4376:
URL: https://github.com/apache/cloudstack/pull/4376#discussion_r502633960



##########
File path: server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java
##########
@@ -2319,9 +2319,9 @@ public ServiceOffering createServiceOffering(final CreateServiceOfferingCmd cmd)
                 throw new InvalidParameterValueException("For creating a custom compute offering cpu and memory all should be null");
             }
             // if any of them is null, then all of them shoull be null
-            if (maxCPU == null || minCPU == null || maxMemory == null || minMemory == null) {
-                if (maxCPU != null || minCPU != null || maxMemory != null || minMemory != null) {
-                    throw new InvalidParameterValueException("For creating a custom compute offering min/max cpu and min/max memory should all be specified");
+            if (maxCPU == null || minCPU == null || maxMemory == null || minMemory == null || cpuSpeed == null) {
+                if (maxCPU != null || minCPU != null || maxMemory != null || minMemory != null || cpuSpeed != null) {
+                    throw new InvalidParameterValueException("For creating a custom compute offering min/max cpu and min/max memory/cpu speed should all be null or all specified");
                 }
             } else {
                 if (cpuSpeed != null && (cpuSpeed.intValue() < 0 || cpuSpeed.longValue() > Integer.MAX_VALUE)) {

Review comment:
       @sureshanaparti indeed, I will remove it.




----------------------------------------------------------------
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.

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