Browse code

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

Chris Yeoh authored on 2013/04/22 10:03:07
Showing 1 changed files
... ...
@@ -96,7 +96,7 @@ if [[ "$ENABLED_SERVICES" =~ "c-vol" ]]; then
96 96
    # Attach volume to an instance
97 97
    euca-attach-volume -i $INSTANCE -d $ATTACH_DEVICE $VOLUME || \
98 98
        die $LINENO "Failure attaching volume $VOLUME to $INSTANCE"
99
-   if ! timeout $ACTIVE_TIMEOUT sh -c "while ! euca-describe-volumes $VOLUME | grep -q in-use; do sleep 1; done"; then
99
+   if ! timeout $ACTIVE_TIMEOUT sh -c "while ! euca-describe-volumes $VOLUME | grep -A 1 in-use | grep -q attach; do sleep 1; done"; then
100 100
        die $LINENO "Could not attach $VOLUME to $INSTANCE"
101 101
    fi
102 102