This is an automated email from the ASF dual-hosted git repository.
dahn pushed a commit to branch 4.14
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/4.14 by this push:
new 94f9f89 server: Fix some cpuspeed issues while create service
offering (#4376)
94f9f89 is described below
commit 94f9f8973666372a1d79ffe81776153d04edad78
Author: Wei Zhou <[email protected]>
AuthorDate: Tue Oct 13 11:32:16 2020 +0200
server: Fix some cpuspeed issues while create service offering (#4376)
---
.../java/com/cloud/configuration/ConfigurationManagerImpl.java | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git
a/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java
b/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java
index 7e9c9d3..5534b74 100755
--- a/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -2319,12 +2319,12 @@ public class ConfigurationManagerImpl extends
ManagerBase implements Configurati
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)) {
+ if (cpuSpeed.intValue() < 0 || cpuSpeed.longValue() >
Integer.MAX_VALUE) {
throw new InvalidParameterValueException("Failed to create
service offering " + offeringName + ": specify the cpu speed value between 1
and " + Integer.MAX_VALUE);
}
if ((maxCPU <= 0 || maxCPU.longValue() > Integer.MAX_VALUE) ||
(minCPU <= 0 || minCPU.longValue() > Integer.MAX_VALUE ) ) {
@@ -2343,7 +2343,7 @@ public class ConfigurationManagerImpl extends ManagerBase
implements Configurati
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)) {
throw new InvalidParameterValueException("Failed to create
service offering " + offeringName + ": specify the cpu speed value between 0
and " + Integer.MAX_VALUE);
}
if (memory != null && (memory.intValue() < 32 ||
memory.longValue() > Integer.MAX_VALUE)) {