Commit 743b4fd9 authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

Do not allow creation of more than one pools

Do not allow creation of more than one Bridge or MacPrefix pool, since
we can not handle them yet.
parent 5b7e28a1
......@@ -682,7 +682,7 @@ class PoolTable(models.Model):
def get_pool(cls):
pool_row = cls.objects.select_for_update().all()[0]
pool_row = cls.objects.select_for_update().get()
return pool_row.pool
except IndexError:
raise pools.EmptyPool
......@@ -71,6 +71,9 @@ class Command(BaseCommand):
pool_table = pool_table_from_type(type_)
if pool_table.objects.exists():
raise CommandError("Pool of type %s already exists" % type_)
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