CLOUDSTACK-2960: [portableIPrange] CS should check the portable ip range, vlan with

existing public ip ranges and vlans

adds a validation check to ensure there is no VLAN in the zones with
same id
This commit is contained in:
Murali Reddy 2013-07-15 16:15:20 +05:30
parent 285f173262
commit 5e0a61d57c
1 changed files with 11 additions and 0 deletions

View File

@ -5067,6 +5067,17 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
if (!NetUtils.isValidVlan(vlanId)) {
throw new InvalidParameterValueException("Invalid vlan id " + vlanId);
}
// check if there is zone vlan with same id
List<DataCenterVO> zones= _zoneDao.listAllZones();
if (zones != null && !zones.isEmpty()) {
for (DataCenterVO zone: zones) {
if (_vlanDao.findByZoneAndVlanId(zone.getId(), vlanId) != null)
throw new InvalidParameterValueException("Found a VLAN id " + vlanId + " already existing in"
+ " zone " + zone.getUuid() + " that conflicts with VLAN id of the portable ip range being configured");
}
}
}
GlobalLock portableIpLock = GlobalLock.getInternLock("PortablePublicIpRange");
portableIpLock.lock(5);