X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fnetworkconfiguration%2Fneutron%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetworkconfig%2Fneutron%2FNeutronSubnet.java;h=d7919394867b0ef67b43ca7c20498f3a21df6ae7;hp=1072a344b0e1f0ac35e2dab68a420892df6e0ee0;hb=d42baa009f97e1bd51b646edc1c247657b976685;hpb=19e6794dbbed4f4bb650772cddc64d93a98e40e0 diff --git a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet.java b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet.java index 1072a344b0..d791939486 100644 --- a/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet.java +++ b/opendaylight/networkconfiguration/neutron/src/main/java/org/opendaylight/controller/networkconfig/neutron/NeutronSubnet.java @@ -341,15 +341,18 @@ public class NeutronSubnet { List newList = new ArrayList(); // we have to modify a separate list while (i.hasNext()) { NeutronSubnet_IPAllocationPool pool = i.next(); - if (pool.getPoolEnd().equalsIgnoreCase(ipAddress) && - pool.getPoolStart().equalsIgnoreCase(ipAddress)) - ; // do nothing, i.e. don't add the current pool to the new list - else + /* if the pool contains a single address element and we are allocating it + * then we don't need to copy the pool over. Otherwise, we need to possibly + * split the pool and add both pieces to the new list + */ + if (!(pool.getPoolEnd().equalsIgnoreCase(ipAddress) && + pool.getPoolStart().equalsIgnoreCase(ipAddress))) { if (pool.contains(ipAddress)) { List pools = pool.splitPool(ipAddress); newList.addAll(pools); } else newList.add(pool); + } } allocationPools = newList; }