List<NeutronSubnet_IPAllocationPool> newList = new ArrayList<NeutronSubnet_IPAllocationPool>(); // we have to modify a separate list\r
while (i.hasNext()) {\r
NeutronSubnet_IPAllocationPool pool = i.next();\r
- if (pool.getPoolEnd().equalsIgnoreCase(ipAddress) &&\r
- pool.getPoolStart().equalsIgnoreCase(ipAddress))\r
- ; // do nothing, i.e. don't add the current pool to the new list\r
- else\r
+ /* if the pool contains a single address element and we are allocating it\r
+ * then we don't need to copy the pool over. Otherwise, we need to possibly\r
+ * split the pool and add both pieces to the new list\r
+ */\r
+ if (!(pool.getPoolEnd().equalsIgnoreCase(ipAddress) &&\r
+ pool.getPoolStart().equalsIgnoreCase(ipAddress))) {\r
if (pool.contains(ipAddress)) {\r
List<NeutronSubnet_IPAllocationPool> pools = pool.splitPool(ipAddress);\r
newList.addAll(pools);\r
} else\r
newList.add(pool);\r
+ }\r
}\r
allocationPools = newList;\r
}\r