cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mike-tutkowski <...@git.apache.org>
Subject [GitHub] cloudstack pull request #1579: CLOUDSTACK-9403 : Support for shared networks...
Date Thu, 16 Feb 2017 18:49:39 GMT
Github user mike-tutkowski commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1579#discussion_r101596817
  
    --- Diff: server/src/com/cloud/configuration/ConfigurationManagerImpl.java ---
    @@ -2909,51 +2911,21 @@ public Vlan doInTransaction(final TransactionStatus status) {
             String vlanGateway = null;
             String vlanNetmask = null;
             boolean sameSubnet = false;
    -        if (vlans != null && vlans.size() > 0) {
    +        if (CollectionUtils.isNotEmpty(vlans)) {
                 for (final VlanVO vlan : vlans) {
    -                if (ipv4) {
    -                    vlanGateway = vlan.getVlanGateway();
    -                    vlanNetmask = vlan.getVlanNetmask();
    -                    // check if subset or super set or neither.
    -                    final NetUtils.SupersetOrSubset val = checkIfSubsetOrSuperset(newVlanGateway,
newVlanNetmask, vlan, startIP, endIP);
    -                    if (val == NetUtils.SupersetOrSubset.isSuperset) {
    -                        // this means that new cidr is a superset of the
    -                        // existing subnet.
    -                        throw new InvalidParameterValueException("The subnet you are
trying to add is a superset of the existing subnet having gateway" + vlan.getVlanGateway()
    -                                + " and netmask  " + vlan.getVlanNetmask());
    -                    } else if (val == NetUtils.SupersetOrSubset.neitherSubetNorSuperset)
{
    -                        // this implies the user is trying to add a new subnet
    -                        // which is not a superset or subset of this subnet.
    -                        // checking with the other subnets.
    -                        continue;
    -                    } else if (val == NetUtils.SupersetOrSubset.isSubset) {
    -                        // this means he is trying to add to the same subnet.
    -                        throw new InvalidParameterValueException("The subnet you are
trying to add is a subset of the existing subnet having gateway" + vlan.getVlanGateway()
    -                                + " and netmask  " + vlan.getVlanNetmask());
    -                    } else if (val == NetUtils.SupersetOrSubset.sameSubnet) {
    -                        sameSubnet = true;
    -                        //check if the gateway provided by the user is same as that of
the subnet.
    -                        if (newVlanGateway != null && !newVlanGateway.equals(vlanGateway))
{
    -                            throw new InvalidParameterValueException("The gateway of
the subnet should be unique. The subnet alreaddy has a gateway " + vlanGateway);
    -                        }
    -                        break;
    -                    }
    -                }
    -                if (ipv6) {
    -                    if (ip6Gateway != null && !ip6Gateway.equals(network.getIp6Gateway()))
{
    -                        throw new InvalidParameterValueException("The input gateway "
+ ip6Gateway + " is not same as network gateway " + network.getIp6Gateway());
    -                    }
    -                    if (ip6Cidr != null && !ip6Cidr.equals(network.getIp6Cidr()))
{
    -                        throw new InvalidParameterValueException("The input cidr " +
ip6Cidr + " is not same as network ciddr " + network.getIp6Cidr());
    -                    }
    -                    ip6Gateway = network.getIp6Gateway();
    -                    ip6Cidr = network.getIp6Cidr();
    -                    _networkModel.checkIp6Parameters(startIPv6, endIPv6, ip6Gateway,
ip6Cidr);
    -                    sameSubnet = true;
    -                }
    +                vlanGateway = vlan.getVlanGateway();
    +                vlanNetmask = vlan.getVlanNetmask();
    +                sameSubnet = hasSameSubnet(ipv4, vlanGateway, vlanNetmask, newVlanGateway,
newVlanNetmask, startIP, endIP,
    +                        ipv6, ip6Gateway, ip6Cidr, startIPv6, endIPv6, network);
    +                if (sameSubnet) break;
                 }
    +        } else {
    +            vlanGateway = network.getGateway();
    +            vlanNetmask = NetUtils.getCidrNetmask(network.getCidr());
    --- End diff --
    
    I believe this is the root of the following blocker for 4.10: https://issues.apache.org/jira/browse/CLOUDSTACK-9790


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message