diff options
author | 2015-12-21 10:05:32 +0100 | |
---|---|---|
committer | 2015-12-21 10:05:32 +0100 | |
commit | 32bea9becc0d26099dd6e65d66544cdeb8f0c3f5 (patch) | |
tree | 2ccdd7d08e403c31c5e3230a0ca09d48eab9183c /testcases/VIM/OpenStack/CI/libraries/clean_openstack.py | |
parent | ec0ee75e9576319f0bf1e4bc2a41dea099fbbce7 (diff) |
Move 'wait for instances to be terminated' after deleting them when cleaning openstack
Change-Id: I0efc8a151357d15003bb3953874b5d4d0f5803dc
Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
Diffstat (limited to 'testcases/VIM/OpenStack/CI/libraries/clean_openstack.py')
-rw-r--r-- | testcases/VIM/OpenStack/CI/libraries/clean_openstack.py | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py b/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py index 4dadcbfb6..bdb1f7ea9 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() |