Commit 55f70aef authored by Dimitris Aragiorgis's avatar Dimitris Aragiorgis Committed by Iustin Pop
Browse files

Fix bug in network module


Signed-off-by: default avatarDimitris Aragiorgis <dimara@grnet.gr>
Signed-off-by: default avatarIustin Pop <iustin@google.com>
[iustin@google.com: slightly improved code flow]
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 425f3ffe
......@@ -201,10 +201,11 @@ class AddressPool(object):
@raise errors.AddressPoolError: Pool is full
"""
if self.IsFull():
raise errors.AddressPoolError("%s is full" % self.network)
idx = self.all_reservations.search(self.FREE, 1)
return str(self.network[idx])
if idx:
return str(self.network[idx[0]])
else:
raise errors.AddressPoolError("%s is full" % self.network)
def GetExternalReservations(self):
"""Returns a list of all externally reserved addresses.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment