Updated Branches:
refs/heads/4.2 7f6312806 -> 9cc1bc40d
CLOUDSTACK-4282
allow overlapped subnet with different VLANs in shared network
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9cc1bc40
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9cc1bc40
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9cc1bc40
Branch: refs/heads/4.2
Commit: 9cc1bc40d25d86148e40c1340558196603c34d70
Parents: 7f63128
Author: Anthony Xu <[email protected]>
Authored: Tue Aug 13 15:11:14 2013 -0700
Committer: Anthony Xu <[email protected]>
Committed: Tue Aug 13 15:12:14 2013 -0700
----------------------------------------------------------------------
.../configuration/ConfigurationManagerImpl.java | 24 ++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9cc1bc40/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 f5e417e..5261462 100755
--- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -3112,12 +3112,28 @@ public class ConfigurationManagerImpl extends
ManagerBase implements Configurati
if( !NetUtils.isNetworksOverlap(newCidr, otherCidr)) {
continue;
}
- // from here, subnet overlaps
+ // from here, subnet overlaps
if ( !vlanId.equals(vlan.getVlanTag()) ) {
- throw new InvalidParameterValueException("The IP range
with tag: " + vlan.getVlanTag()
- + " in zone " + zone.getName()
- + " has overlapped with the subnet. Please specify
a different gateway/netmask.");
+ boolean overlapped = false;
+ if( network.getTrafficType() == TrafficType.Public ) {
+ overlapped = true;
+ } else {
+ Long nwId = vlan.getNetworkId();
+ if ( nwId != null ) {
+ Network nw = _networkModel.getNetwork(nwId);
+ if ( nw != null && nw.getTrafficType() ==
TrafficType.Public ) {
+ overlapped = true;
+ }
+ }
+
+ }
+ if ( overlapped ) {
+ throw new InvalidParameterValueException("The IP range
with tag: " + vlan.getVlanTag()
+ + " in zone " + zone.getName()
+ + " has overlapped with the subnet. Please
specify a different gateway/netmask.");
+ }
}
+
if ( vlan.getNetworkId() != networkId) {
throw new InvalidParameterValueException("This subnet is
overlapped with subnet in other network " + vlan.getNetworkId()
+ " in zone " + zone.getName()