Fix attach volume detect in euca test

Fixes test for detecting when a volume has been successfully
attached to an instance to not just rely on the state being
in-use, but also be marked as "attached". The attachment
state will be displayed when https://review.openstack.org/#/c/27098/
goes through. The attachment state is not currently displayed
by euca-describe-volumes because of the extraneous data returned
by the API as per bug #1074901.

In the meantime the "attaching" status of the volume itself, rather
than the attachment state, suffices for the test to work properly, but in the long
term this will disappear as it is not a valid ec2 API state and
volumes will move straight to the in-use state.

Fixes bug #1170548

Change-Id: Id38f37e1a0efc991f60da35145f809d98b5f41cd
This commit is contained in:
Chris Yeoh 2013-04-22 10:33:07 +09:30
parent 181b41b6ff
commit c2fc5f890e

View File

@ -96,7 +96,7 @@ if [[ "$ENABLED_SERVICES" =~ "c-vol" ]]; then
# Attach volume to an instance # Attach volume to an instance
euca-attach-volume -i $INSTANCE -d $ATTACH_DEVICE $VOLUME || \ euca-attach-volume -i $INSTANCE -d $ATTACH_DEVICE $VOLUME || \
die $LINENO "Failure attaching volume $VOLUME to $INSTANCE" die $LINENO "Failure attaching volume $VOLUME to $INSTANCE"
if ! timeout $ACTIVE_TIMEOUT sh -c "while ! euca-describe-volumes $VOLUME | grep -q in-use; do sleep 1; done"; then if ! timeout $ACTIVE_TIMEOUT sh -c "while ! euca-describe-volumes $VOLUME | grep -A 1 in-use | grep -q attach; do sleep 1; done"; then
die $LINENO "Could not attach $VOLUME to $INSTANCE" die $LINENO "Could not attach $VOLUME to $INSTANCE"
fi fi