Adding a network failed in the corner case of adding
a network with just one IP address, because it would try
to reserve the same IP twice. Fixing the way we iterate
over all IPs does the trick.

Signed-off-by: Helga Velroyen <[email protected]>
---
 lib/network.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/network.py b/lib/network.py
index cc3bfd6..4656a88 100644
--- a/lib/network.py
+++ b/lib/network.py
@@ -224,7 +224,7 @@ class AddressPool(object):
     """
     obj = cls(net)
     obj.Update()
-    for ip in [obj.network[0], obj.network[-1]]:
+    for ip in obj.network:
       obj.Reserve(ip, external=True)
     if obj.net.gateway is not None:
       obj.Reserve(obj.net.gateway, external=True)
-- 
1.7.7.3

Reply via email to