aboutsummaryrefslogtreecommitdiffstats
path: root/testcases/functest_utils.py
diff options
context:
space:
mode:
authorViktor Tikkanen <viktor.tikkanen@nokia.com>2016-01-12 13:37:41 +0200
committerMorgan Richomme <morgan.richomme@orange.com>2016-01-12 13:41:07 +0000
commit798e64c3b864c1b19b214d21d87c4182718043cc (patch)
treef505f88172873898aeb8cf267232bdb69a41b8f5 /testcases/functest_utils.py
parent28922033f941ef1800f019b06002076f1d3067bb (diff)
Cleanup functionality improved
1. All the existing external networks will be preserved. 2. Forced deleting is used for volumes with wrong status. 3. Added forced removing of hanging ports in case of network:router_interface ownership. Change-Id: Ibd51b98d6bf2a5d82f16f070003128e3200f99ed Signed-off-by: Viktor Tikkanen <viktor.tikkanen@nokia.com> (cherry picked from commit 5380c97d53cf7f198e75e9cd5531e758edbc76ff)
Diffstat (limited to 'testcases/functest_utils.py')
-rw-r--r--testcases/functest_utils.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/testcases/functest_utils.py b/testcases/functest_utils.py
index 888c043fd..53f5706c9 100644
--- a/testcases/functest_utils.py
+++ b/testcases/functest_utils.py
@@ -414,10 +414,16 @@ def get_volumes(cinder_client):
except:
return None
-
-def delete_volume(cinder_client, volume_id):
- try:
- cinder_client.volumes.delete(volume_id)
+def delete_volume(cinder_client, volume_id, forced=False):
+ try:
+ if forced:
+ try:
+ cinder_client.volumes.detach(volume_id)
+ except:
+ print "Error:", sys.exc_info()[0]
+ cinder_client.volumes.force_delete(volume_id)
+ else:
+ cinder_client.volumes.delete(volume_id)
return True
except:
print "Error:", sys.exc_info()[0]