summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorghanshyam <ghanshyam.mann@nectechnologies.in>2014-10-14 17:23:31 +0900
committerghanshyam <ghanshyam.mann@nectechnologies.in>2014-10-14 17:23:31 +0900
commit308640c1121f5a4ca33c7723397457e2288c212e (patch)
tree6a43290726517904844b7564cba4ba17bd9bed67
parentdbc8e82b84c2f71cb4ab5eecc135b556b449e9b7 (diff)
downloadtempest-308640c1121f5a4ca33c7723397457e2288c212e.tar.gz
Fix cleanup for EC2 test_compute_with_volumes
Volume cleanup for test_compute_with_volumes fails when volume is in "error" state. cleanup part destroy_volume_wait() is to delete the volume and detach before delete if necessary. In destroy_volume_wait(), before detaching the volume there is checks if volume status is not "available" but that is not sufficient enough to guarantee that volume is attached. Volume status can be "error". When something wrong happens with Volume and Volume is in "error" state then, detach request will through the error as mentioned in bug# 1310896. Logic in destroy_volume_wait should be checking of state as "in-use" before trying to detach volume. So that if it is in "in-use" state then detach and go for volume delete. If not in "in-use" ("available" or "error" etc) then only go for volume delete. Change-Id: I1882dbba947cc294cb4fe119db50f2a1c23b75be Related-Bug: #1310896
-rw-r--r--tempest/thirdparty/boto/test.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/tempest/thirdparty/boto/test.py b/tempest/thirdparty/boto/test.py
index 3496dce5d..62073bdc6 100644
--- a/tempest/thirdparty/boto/test.py
+++ b/tempest/thirdparty/boto/test.py
@@ -498,7 +498,10 @@ class BotoTestCase(tempest.test.BaseTestCase):
def _volume_state():
volume.update(validate=True)
try:
- if volume.status != "available":
+ # NOTE(gmann): Make sure volume is attached.
+ # Checking status as 'not "available"' is not enough to make
+ # sure volume is attached as it can be in "error" state
+ if volume.status == "in-use":
volume.detach(force=True)
except BaseException:
LOG.exception("Failed to detach volume %s" % volume)