diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java index 3d5214d85c5..d1a0887b28a 100644 --- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java +++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java @@ -2020,14 +2020,14 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati } } - if ((cpuNumber != null) && ((cpuNumber.intValue() <= 0) || (cpuNumber.intValue() > 2147483647))) { - throw new InvalidParameterValueException("Failed to create service offering " + name + ": specify the cpu number value between 1 and 2147483647"); + if ((cpuNumber != null) && ((cpuNumber.intValue() <= 0) || (cpuNumber.longValue() > Integer.MAX_VALUE))) { + throw new InvalidParameterValueException("Failed to create service offering " + name + ": specify the cpu number value between 1 and " + Integer.MAX_VALUE); } - if ((cpuSpeed != null) && ((cpuSpeed.intValue() < 0) || (cpuSpeed.intValue() > 2147483647))) { - throw new InvalidParameterValueException("Failed to create service offering " + name + ": specify the cpu speed value between 1 and 2147483647"); + if ((cpuSpeed != null) && ((cpuSpeed.intValue() < 0) || (cpuSpeed.longValue() > Integer.MAX_VALUE))) { + throw new InvalidParameterValueException("Failed to create service offering " + name + ": specify the cpu speed value between 0 and " + Integer.MAX_VALUE); } - if ((memory != null) && ((memory.intValue() < 32) || (memory.intValue() > 2147483647))) { - throw new InvalidParameterValueException("Failed to create service offering " + name + ": specify the memory value between 32 and 2147483647 MB"); + if ((memory != null) && ((memory.intValue() < 32) || (memory.longValue() > Integer.MAX_VALUE))) { + throw new InvalidParameterValueException("Failed to create service offering " + name + ": specify the memory value between 32 and " + Integer.MAX_VALUE + " MB"); } // check if valid domain diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java index 605306e02fc..170c612a7de 100644 --- a/server/src/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/com/cloud/vm/UserVmManagerImpl.java @@ -882,7 +882,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir if (serviceOffering.getCpu() == null) { String cpuNumber = customParameters.get(UsageEventVO.DynamicParameters.cpuNumber.name()); if ((cpuNumber == null) || (NumbersUtil.parseInt(cpuNumber, -1) <= 0)) { - throw new InvalidParameterValueException("Invalid cpu cores value, specify a value between 1 and 2147483647"); + throw new InvalidParameterValueException("Invalid cpu cores value, specify a value between 1 and " + Integer.MAX_VALUE); } } else if (customParameters.containsKey(UsageEventVO.DynamicParameters.cpuNumber.name())) { throw new InvalidParameterValueException("The cpu cores of this offering id:" + serviceOffering.getId() @@ -892,7 +892,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir if (serviceOffering.getSpeed() == null) { String cpuSpeed = customParameters.get(UsageEventVO.DynamicParameters.cpuSpeed.name()); if ((cpuSpeed == null) || (NumbersUtil.parseInt(cpuSpeed, -1) <= 0)) { - throw new InvalidParameterValueException("Invalid cpu speed value, specify a value between 1 and 2147483647"); + throw new InvalidParameterValueException("Invalid cpu speed value, specify a value between 1 and " + Integer.MAX_VALUE); } } else if (customParameters.containsKey(UsageEventVO.DynamicParameters.cpuSpeed.name())) { throw new InvalidParameterValueException("The cpu speed of this offering id:" + serviceOffering.getId() @@ -902,7 +902,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir if (serviceOffering.getRamSize() == null) { String memory = customParameters.get(UsageEventVO.DynamicParameters.memory.name()); if (memory == null || (NumbersUtil.parseInt(memory, -1) < 32)) { - throw new InvalidParameterValueException("Invalid memory value, specify a value between 32 and 2147483647 MB"); + throw new InvalidParameterValueException("Invalid memory value, specify a value between 32 and " + Integer.MAX_VALUE + " MB"); } } else if (customParameters.containsKey(UsageEventVO.DynamicParameters.memory.name())) { throw new InvalidParameterValueException("The memory of this offering id:" + serviceOffering.getId() + " is not customizable. This is predefined in the template.");