diff options
Diffstat (limited to 'testcases/functest_utils.py')
-rw-r--r-- | testcases/functest_utils.py | 14 |
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] |