Commit 88237753 authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

Get public network by public attribute

Do not find the public network by the primary key, as the initial_data.json
is obsolete. Instead, ise the public attribute of the Network Model.
Currently only one public Network is supported, and the used can not
create or delete the public Network. But this can easily change in the
parent a1624f8f
......@@ -287,7 +287,10 @@ def create_instance(vm, flavor, image, password, personality):
# Get the Network object in exclusive mode in order to
# safely (isolated) reserve an IP address
network = Network.objects.select_for_update().get(id=1)
network = Network.objects.select_for_update().get(public=True)
except Network.DoesNotExist:
raise Exception('No public network available')
pool = ippool.IPPool(network)
address = pool.get_free_address()
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