mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
bug 7835: fixing the vnet range issues for add zone and edit zone
status 7835: resolved fixed
This commit is contained in:
parent
5743db87e1
commit
e28ed752fc
@ -962,6 +962,8 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
||||
// String domain = cmd.getDomain();
|
||||
Long userId = UserContext.current().getCallerUserId();
|
||||
// Long domainId = cmd.getDomainId();
|
||||
int startVnetRange = 0;
|
||||
int stopVnetRange = 0;
|
||||
|
||||
if (userId == null) {
|
||||
userId = Long.valueOf(User.UID_SYSTEM);
|
||||
@ -991,6 +993,33 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
||||
if (zoneHasAllocatedVnets(zoneId)) {
|
||||
throw new CloudRuntimeException("The vlan range is not editable because there are allocated vlans.");
|
||||
}
|
||||
|
||||
String[] startStopRange = new String[2];
|
||||
startStopRange = vnetRange.split("-");
|
||||
|
||||
if(startStopRange.length == 1) {
|
||||
throw new InvalidParameterValueException("Please provide valid vnet range between 0-4096");
|
||||
}
|
||||
|
||||
if(startStopRange[0] == null || startStopRange[1] == null) {
|
||||
throw new InvalidParameterValueException("Please provide valid vnet range between 0-4096");
|
||||
}
|
||||
|
||||
try {
|
||||
startVnetRange = Integer.parseInt(startStopRange[0]);
|
||||
stopVnetRange = Integer.parseInt(startStopRange[1]);
|
||||
} catch (NumberFormatException e) {
|
||||
s_logger.warn("Unable to parse vnet range:",e);
|
||||
throw new InvalidParameterValueException("Please provide valid vnet range between 0-4096");
|
||||
}
|
||||
|
||||
if(startVnetRange < 0 || stopVnetRange > 4096) {
|
||||
throw new InvalidParameterValueException("Vnet range has to be between 0-4096");
|
||||
}
|
||||
|
||||
if(startVnetRange > stopVnetRange) {
|
||||
throw new InvalidParameterValueException("Vnet range has to be between 0-4096 and start range should be lesser than or equal to stop range");
|
||||
}
|
||||
}
|
||||
|
||||
String oldZoneName = zone.getName();
|
||||
@ -1115,6 +1144,11 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
||||
} catch (NumberFormatException e) {
|
||||
throw new InvalidParameterValueException("Please specify valid integers for the vlan range.");
|
||||
}
|
||||
|
||||
if(vnetStart > vnetEnd) {
|
||||
s_logger.warn("Invalid vnet range: start range:"+vnetStart+" end range:"+vnetEnd);
|
||||
throw new InvalidParameterValueException("Vnet range should be between 0-4096 and start range should be lesser than or equal to end range");
|
||||
}
|
||||
}
|
||||
|
||||
//checking the following params outside checkzoneparams method as we do not use these params for updatezone
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user