diff options
author | 2017-03-10 13:18:53 +0000 | |
---|---|---|
committer | 2017-03-10 13:18:53 +0000 | |
commit | 6587f877a3c6e2954d9e32a0652c6f0d1d356ab7 (patch) | |
tree | bb16d002203e909d9432cae334d0a4a92ab17196 /functest/utils/openstack_clean.py | |
parent | f8fe3aa383b06d0edc92e8844c4c1ad5ceb2b76b (diff) | |
parent | 430b7e154f847b0dfb99c8419a999074e175e1e7 (diff) |
Merge "Add extra check to avoid double delete of instances"
Diffstat (limited to 'functest/utils/openstack_clean.py')
-rwxr-xr-x | functest/utils/openstack_clean.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/functest/utils/openstack_clean.py b/functest/utils/openstack_clean.py index 15a8f33d5..ce61fcacf 100755 --- a/functest/utils/openstack_clean.py +++ b/functest/utils/openstack_clean.py @@ -49,9 +49,14 @@ def remove_instances(nova_client, default_instances): for instance in instances: instance_name = getattr(instance, 'name') instance_id = getattr(instance, 'id') + instance_status = getattr(instance, 'status') + instance_state = getattr(instance, 'OS-EXT-STS:task_state') + logger.debug("'%s', ID=%s " % (instance_name, instance_id)) if (instance_id not in default_instances and - instance_name not in default_instances.values()): + instance_name not in default_instances.values() and + instance_status != 'DELETED' and + (instance_status != 'BUILD' or instance_state != 'deleting')): logger.debug("Removing instance '%s' ..." % instance_id) if os_utils.delete_instance(nova_client, instance_id): logger.debug(" > Request sent.") |