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
committerViktor Tikkanen <viktor.tikkanen@nokia.com>2016-01-12 13:38:51 +0200
commit5380c97d53cf7f198e75e9cd5531e758edbc76ff (patch)
treef505f88172873898aeb8cf267232bdb69a41b8f5 /testcases/functest_utils.py
parentfd2d6e5b9fcfdf8cffb0aa4ea27568334cb374e8 (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>
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]