Commit 7c296288 authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

cyclades: Add 'SNF:floating_ip_pool' to networks

Extend network API methods to include the 'SNF:floating_ip_pool'
attribute which indicates whether floating IP can be allocated from the
network or not. Trying to allocate a floating IP from a network which is
not not a floating IP pool will return Conflict(409).
parent 54316010
......@@ -157,10 +157,9 @@ def allocate_floating_ip(request):
network = util.get_network(network_id, userid, for_update=True,
if not network.floating_ip_pool:
# TODO: Maybe 409 ??
# Check that it is a floating IP pool
raise faults.ItemNotFound("Floating IP pool %s does not exist." %
msg = ("Can not allocate floating IP from network %s. Network is"
" not a floating IP pool." % network)
raise faults.Conflict(msg)
address = api.utils.get_attribute(floating_ip_dict,
......@@ -173,6 +173,7 @@ def network_to_dict(network, detail=True):
d['external_router'] = network.external_router
d['admin_state_up'] = True
d['subnets'] = list(network.subnets.values_list('id', flat=True))
d['SNF:floating_ip_pool'] = network.floating_ip_pool
return d
......@@ -163,7 +163,7 @@ class FloatingIPAPITest(BaseAPITest):
response =, "test_user", json.dumps(request), "json")
self.assertEqual(response.status_code, 404)
# Full network
net = mf.NetworkWithSubnetFactory(floating_ip_pool=True,
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