Skip to content

Commit 490d499

Browse files
committed
CLOUDSTACK-7453: Network rate field specified with negative value in service offering results in db Exception
1 parent fe6f0cf commit 490d499

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

‎server/src/com/cloud/configuration/ConfigurationManagerImpl.java‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2045,8 +2045,13 @@ public ServiceOffering createServiceOffering(CreateServiceOfferingCmd cmd) {
20452045
allowNetworkRate = true;
20462046
}
20472047

2048-
if (cmd.getNetworkRate() != null && !allowNetworkRate) {
2049-
throw new InvalidParameterValueException("Network rate can be specified only for non-System offering and system offerings having \"domainrouter\" systemvmtype");
2048+
if (cmd.getNetworkRate() != null) {
2049+
if(!allowNetworkRate) {
2050+
throw new InvalidParameterValueException("Network rate can be specified only for non-System offering and system offerings having \"domainrouter\" systemvmtype");
2051+
}
2052+
if(cmd.getNetworkRate().intValue() <= 1) {
2053+
throw new InvalidParameterValueException("Failed to create service offering " + name + ": specify the network rate value more than 0");
2054+
}
20502055
}
20512056

20522057
if (cmd.getDeploymentPlanner() != null) {

0 commit comments

Comments
 (0)