From 32bea9becc0d26099dd6e65d66544cdeb8f0c3f5 Mon Sep 17 00:00:00 2001 From: "jose.lausuch" Date: Mon, 21 Dec 2015 10:05:32 +0100 Subject: Move 'wait for instances to be terminated' after deleting them when cleaning openstack Change-Id: I0efc8a151357d15003bb3953874b5d4d0f5803dc Signed-off-by: jose.lausuch --- .../VIM/OpenStack/CI/libraries/clean_openstack.py | 27 +++++++++++----------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'testcases') diff --git a/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py b/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py index 4dadcbfb..bdb1f7ea 100644 --- a/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py +++ b/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py @@ -50,7 +50,7 @@ ch.setFormatter(formatter) logger.addHandler(ch) default_images = ['TestVM'] -default_networks = ['net04', 'net04_ext'] +default_networks = ['net04', 'net04_ext', 'functest-net'] default_routers = ['router04'] default_users = ["heat", "heat-cfn", "cinder", "nova", "swift", "glance", "neutron", "admin", "fuel_stats_user", "quantum", "heat-cfn_heat", @@ -78,6 +78,16 @@ def remove_instances(nova_client): logger.info(" > ERROR: There has been a problem removing the " "instance %s..." % instance_id) + timeout = 50 + while timeout > 0: + instances = functest_utils.get_instances(nova_client) + if instances is None or len(instances) == 0: + break + else: + logger.debug("Waiting for instances to be terminated...") + timeout -= 1 + time.sleep(1) + def remove_images(nova_client): logger.info("Removing Glance images...") @@ -101,19 +111,8 @@ def remove_images(nova_client): logger.debug(" > this is a default image and will NOT be deleted.") -def remove_volumes(cinder_client, nova_client): +def remove_volumes(cinder_client): logger.info("Removing Cinder volumes...") - - timeout = 50 - while timeout > 0: - instances = functest_utils.get_instances(nova_client) - if instances is None or len(instances) == 0: - break - else: - logger.debug("Waiting for instances to be terminated...") - timeout -= 1 - time.sleep(1) - volumes = functest_utils.get_volumes(cinder_client) if volumes is None or len(volumes) == 0: logger.debug("No volumes found.") @@ -347,7 +346,7 @@ def main(): separator() remove_images(nova_client) separator() - remove_volumes(cinder_client, nova_client) + remove_volumes(cinder_client) separator() remove_floatingips(nova_client) separator() -- cgit 1.2.3-korg