Updated Branches:
refs/heads/master 0c1800f70 -> a3b1a49c3
CLOUDSTACK-3911: [PortableIP] there is no check while adding a zone
public range to see whether the same VLAN exists in portable IP range.
added check to enusre a VLAN id used for a public IP range is not used
for portable ip range
Conflicts:
server/src/com/cloud/configuration/ConfigurationManagerImpl.java
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a3b1a49c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a3b1a49c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a3b1a49c
Branch: refs/heads/master
Commit: a3b1a49c303a929c754561ca07fd8a9ed84e0382
Parents: 0c1800f
Author: Murali Reddy <[email protected]>
Authored: Fri Oct 18 17:22:03 2013 +0530
Committer: Murali Reddy <[email protected]>
Committed: Fri Oct 18 17:34:03 2013 +0530
----------------------------------------------------------------------
.../configuration/ConfigurationManagerImpl.java | 26 ++++++++++++++++----
1 file changed, 21 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a3b1a49c/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
index a0be496..349bd54 100755
--- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -2927,11 +2927,7 @@ public class ConfigurationManagerImpl extends
ManagerBase implements Configurati
// Check if there are any errors with the IP range
checkPublicIpRangeErrors(zoneId, vlanId, vlanGateway, vlanNetmask,
startIP, endIP);
- // check and throw exception if there is portable IP range that
overlaps with ip range being configure
- if (checkOverlapPortableIpRange(_regionDao.getRegionId(), startIP,
endIP)) {
- throw new InvalidParameterValueException("Ip range: " +
startIP + "-" + endIP +
- " overlaps with a portable" + " IP range already
configured in the region " + _regionDao.getRegionId());
- }
+ checkConflictsWithPortableIpRange(zoneId, vlanId, vlanGateway,
vlanNetmask, startIP, endIP);
// Throw an exception if this subnet overlaps with subnet on other
VLAN,
// if this is ip range extension, gateway, network mask should be
same and ip range should not overlap
@@ -3393,6 +3389,26 @@ public class ConfigurationManagerImpl extends
ManagerBase implements Configurati
}
}
+ private void checkConflictsWithPortableIpRange(long zoneId, String vlanId,
String vlanGateway, String vlanNetmask,
+ String startIP, String endIP) {
+ // check and throw exception if there is portable IP range that
overlaps with public ip range being configured
+ if (checkOverlapPortableIpRange(_regionDao.getRegionId(), startIP,
endIP)) {
+ throw new InvalidParameterValueException("Ip range: " + startIP +
"-" + endIP
+ + " overlaps with a portable" + " IP range already
configured in the region " + _regionDao.getRegionId());
+ }
+
+ // verify and throw exception if the VLAN Id is used by any portable
IP range
+ List<PortableIpRangeVO> existingPortableIPRanges =
_portableIpRangeDao.listByRegionId(_regionDao.getRegionId());
+ if (existingPortableIPRanges != null &&
!existingPortableIPRanges.isEmpty()) {
+ for (PortableIpRangeVO portableIpRange : existingPortableIPRanges)
{
+ if (portableIpRange.getVlanTag().equalsIgnoreCase(vlanId)) {
+ throw new InvalidParameterValueException("The VLAN tag " +
vlanId
+ + " is already being used for portable ip range in
this region");
+ }
+ }
+ }
+ }
+
private String getCidrAddress(String cidr) {
String[] cidrPair = cidr.split("\\/");
return cidrPair[0];