Commit 6849b899 authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

cyclades: Fix wrong state of deleted networks

Before deleting a network, the network is marked as drained to be
excluded from automatic IP allocation. The state of the network that is
exposed in the API is always 'SNF:DRAINED' if the drained flag is set.
This resulted in deleted networks to appear as 'SNF:DRAINED'. This
commit fixes this issue by clearing the 'drained' flag when deleting the

Also, this commit sets the 'drained' flag only when deleting public
networks that can take part in automatic IP allocation. For private
networs setting this flag is not needed.
parent b7543281
......@@ -503,6 +503,9 @@ def update_network_state(network):, network.mac_prefix,
network.deleted = True
network.state = "DELETED"
# Undrain the network, otherwise the network state will remain
network.drained = False
if network.mac_prefix:
if network.FLAVORS[network.flavor]["mac_prefix"] == "pool":
......@@ -147,7 +147,8 @@ def delete(network):
network.action = "DESTROY"
# Mark network as drained to prevent automatic allocation of
# public/floating IPs while the network is being deleted
network.drained = True
if network.public:
network.drained = True
# Delete network to all backends that exists
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