From 2e3fff5b94621991a77f30e9bf66febf7109ada7 Mon Sep 17 00:00:00 2001 From: alena Date: Mon, 20 Jun 2011 16:15:01 -0700 Subject: [PATCH] bug 10219: Untagged vlan ranges in Public network should have the same subnet status 10219: resolved fixed --- .../cloud/configuration/ConfigurationManagerImpl.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java index cbe3893920e..41343d68b7c 100755 --- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java +++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java @@ -2072,6 +2072,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura // being added // 3. Another VLAN in the same zone that has the same tag and subnet as the new VLAN has a different gateway than the // new VLAN + // 4. If VLAN is untagged and Virtual, and there is existing UNTAGGED vlan with different subnet List vlans = _vlanDao.listByZone(zone.getId()); for (VlanVO vlan : vlans) { String otherVlanGateway = vlan.getVlanGateway(); @@ -2083,10 +2084,16 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura otherVlanEndIP = otherVlanIpRange[1]; } - if (!vlanId.equals(vlan.getVlanTag()) && newVlanSubnet.equals(otherVlanSubnet) && !allowIpRangeOverlap(vlan, forVirtualNetwork, networkId)) { + if (forVirtualNetwork && !vlanId.equals(vlan.getVlanTag()) && newVlanSubnet.equals(otherVlanSubnet) && !allowIpRangeOverlap(vlan, forVirtualNetwork, networkId)) { throw new InvalidParameterValueException("The IP range with tag: " + vlan.getVlanTag() + " in zone " + zone.getName() + " has the same subnet. Please specify a different gateway/netmask."); } + + boolean vlansUntaggedAndVirtual = (vlanId.equals(Vlan.UNTAGGED) && vlanId.equals(vlan.getVlanTag()) && forVirtualNetwork && vlan.getVlanType() == VlanType.VirtualNetwork); + + if (vlansUntaggedAndVirtual && !newVlanSubnet.equals(otherVlanSubnet)) { + throw new InvalidParameterValueException("The Untagged ip range with different subnet already exists in zone " + zone.getId()); + } if (vlanId.equals(vlan.getVlanTag()) && newVlanSubnet.equals(otherVlanSubnet)) { if (NetUtils.ipRangesOverlap(startIP, endIP, otherVlanStartIP, otherVlanEndIP)) {