From fe48d53cab8f13adee0f46b29376f81811e94c58 Mon Sep 17 00:00:00 2001
From: Dimitris Aragriorgs <dimara@grnet.gr>
Date: Wed, 5 Sep 2012 20:02:50 +0300
Subject: [PATCH] Do not allow networks with less than 8 hosts

This is only needed in case base64 and bitarray.tostring() is used for
saving reservations. If bitarray.to01() was used then we would not have
this restriction.

Signed-off-by: Dimitris Aragriorgs <dimara@grnet.gr>
---
 lib/network.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/network.py b/lib/network.py
index 58dbcf647..c424223a6 100644
--- a/lib/network.py
+++ b/lib/network.py
@@ -75,6 +75,7 @@ class AddressPool(object):
       self.ext_reservations = bitarray(self.network.numhosts)
       self.ext_reservations.setall(False)
 
+    assert self.network.numhosts >= 8
     assert len(self.reservations) == self.network.numhosts
     assert len(self.ext_reservations) == self.network.numhosts
 
-- 
GitLab