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

cyclades: Check drained only if not destroying

Check drained flag only if network actions is not destroy. When network
is being destroyed the network is automatically marked as drained to
exclude it from IP allocations.
parent 1e87c634
......@@ -413,12 +413,12 @@ def _create_port(userid, network, machine=None, use_ipaddress=None,
if network.state != "ACTIVE":
raise faults.Conflict("Cannot create port while network '%s' is in"
" '%s' status" % (network.id, network.state))
elif network.drained:
raise faults.Conflict("Cannot create port while network %s is in"
" 'SNF:DRAINED' status" % network.id)
elif network.action == "DESTROY":
msg = "Cannot create port. Network %s is being deleted."
raise faults.Conflict(msg % network.id)
elif network.drained:
raise faults.Conflict("Cannot create port while network %s is in"
" 'SNF:DRAINED' status" % network.id)
ipaddress = None
if use_ipaddress is not None:
......
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