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
1 file changed