From 490d499b7fe0fa60dfeb37cfe76fff99fce41018 Mon Sep 17 00:00:00 2001 From: Saksham Srivastava Date: Thu, 28 Aug 2014 15:16:58 +0530 Subject: [PATCH] CLOUDSTACK-7453: Network rate field specified with negative value in service offering results in db Exception --- .../cloud/configuration/ConfigurationManagerImpl.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java index 3328b7c83fe..893ee4e441b 100755 --- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java +++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java @@ -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) {