aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJose Lausuch <jose.lausuch@ericsson.com>2016-09-02 07:37:02 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2016-09-02 07:37:02 +0000
commit671fa3d0f8a6963090c27b3ecc7c663cb68be8d3 (patch)
treeac60808978457f49b4277e647fea12b065535fde
parenta37f4d0032150d3c1037a30b2be842c3a4139b45 (diff)
parentc7effe57d86f77e1d824b9c927d9e8ab70a59695 (diff)
Merge "Fixes cleaning up HA Neutron objects"
-rwxr-xr-xutils/openstack_clean.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/utils/openstack_clean.py b/utils/openstack_clean.py
index 8aba763c..3b937c91 100755
--- a/utils/openstack_clean.py
+++ b/utils/openstack_clean.py
@@ -202,9 +202,20 @@ def remove_networks(neutron_client, default_networks, default_routers):
else:
remove_routers(neutron_client, routers, default_routers)
+ # trozet: wait for Neutron to auto-cleanup HA networks when HA router is
+ # deleted
+ time.sleep(5)
+
# remove networks
if network_ids is not None:
for net_id in network_ids:
+ networks = os_utils.get_network_list(neutron_client)
+ if networks is None:
+ logger.debug("No networks left to remove")
+ break
+ elif not any(network['id'] == net_id for network in networks):
+ logger.debug("Network %s has already been removed" % net_id)
+ continue
logger.debug("Removing network %s ..." % net_id)
if os_utils.delete_neutron_net(neutron_client, net_id):
logger.debug(" > Done!")