server: Fix some cpuspeed issues while create service offering#4376
server: Fix some cpuspeed issues while create service offering#4376DaanHoogland merged 2 commits intoapache:4.14from
Conversation
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)
|
@blueorangutan package |
|
@DaanHoogland a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔centos7 ✖centos8 ✔debian. JID-2127 |
|
@blueorangutan test |
|
@DaanHoogland a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
Trillian test result (tid-2899)
|
| 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)) { |
There was a problem hiding this comment.
cpuSpeed null check not required here, it is always not null as per the above changes.
| 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)) { |
There was a problem hiding this comment.
@ustcweizhou similar cond check applicable for cpuNumber and memory if these are mandatory params? check and update accordingly.
There was a problem hiding this 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.
Description
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)
Types of changes
Screenshots (if appropriate):
How Has This Been Tested?