CLOUDSTACK-7453: Network rate field specified with negative value in service offering results in db Exception

This commit is contained in:
Saksham Srivastava 2014-08-28 15:16:58 +05:30
parent fe6f0cf626
commit 490d499b7f
1 changed files with 7 additions and 2 deletions

View File

@ -2045,8 +2045,13 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
allowNetworkRate = true;
}
if (cmd.getNetworkRate() != null && !allowNetworkRate) {
throw new InvalidParameterValueException("Network rate can be specified only for non-System offering and system offerings having \"domainrouter\" systemvmtype");
if (cmd.getNetworkRate() != null) {
if(!allowNetworkRate) {
throw new InvalidParameterValueException("Network rate can be specified only for non-System offering and system offerings having \"domainrouter\" systemvmtype");
}
if(cmd.getNetworkRate().intValue() <= 1) {
throw new InvalidParameterValueException("Failed to create service offering " + name + ": specify the network rate value more than 0");
}
}
if (cmd.getDeploymentPlanner() != null) {