diff options
author | jose.lausuch <jose.lausuch@ericsson.com> | 2015-12-21 19:17:52 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@172.30.200.206> | 2015-12-21 19:17:52 +0000 |
commit | 4608d236c3f9029260f1f7aec24e4f301c37a835 (patch) | |
tree | edae5929c5038011cfeb85c8449bc608f57acc0c | |
parent | b965f0c5115467e3bd863d61f91246b62b36803e (diff) | |
parent | 32bea9becc0d26099dd6e65d66544cdeb8f0c3f5 (diff) |
Merge "Move 'wait for instances to be terminated' after deleting them when cleaning openstack"
-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() |