Modify euca test to get zone using describe

This modifies the euca test to include describe-availability-zones
so that it is covered. This allows us to not need to hard-code a
zone name for the volume tests.

Change-Id: Iaae0589d4338d948981ca6e2229d2ceb73ff38ef
This commit is contained in:
Vishvananda Ishaya 2012-09-21 23:20:06 +00:00
parent 9dce274dac
commit dc9e2880a3

View File

@ -24,7 +24,6 @@ set -o xtrace
# Keep track of the current directory # Keep track of the current directory
EXERCISE_DIR=$(cd $(dirname "$0") && pwd) EXERCISE_DIR=$(cd $(dirname "$0") && pwd)
TOP_DIR=$(cd $EXERCISE_DIR/..; pwd) TOP_DIR=$(cd $EXERCISE_DIR/..; pwd)
VOLUME_ZONE=nova
VOLUME_SIZE=1 VOLUME_SIZE=1
ATTACH_DEVICE=/dev/vdc ATTACH_DEVICE=/dev/vdc
@ -75,11 +74,15 @@ fi
# Volumes # Volumes
# ------- # -------
if [[ "$ENABLED_SERVICES" =~ "n-vol" || "$ENABLED_SERVICES" =~ "c-vol" ]]; then if [[ "$ENABLED_SERVICES" =~ "n-vol" || "$ENABLED_SERVICES" =~ "c-vol" ]]; then
VOLUME_ZONE=`euca-describe-availability-zones | head -n1 | cut -f2`
die_if_not_set VOLUME_ZONE "Failure to find zone for volume"
VOLUME=`euca-create-volume -s 1 -z $VOLUME_ZONE | cut -f2` VOLUME=`euca-create-volume -s 1 -z $VOLUME_ZONE | cut -f2`
die_if_not_set VOLUME "Failure to create volume" die_if_not_set VOLUME "Failure to create volume"
# Test that volume has been created # Test that volume has been created
VOLUME=`euca-describe-volumes | cut -f2` VOLUME=`euca-describe-volumes | cut -f2`
die_if_not_set VOLUME "Failure to get volume"
# Test volume has become available # Test volume has become available
if ! timeout $ASSOCIATE_TIMEOUT sh -c "while ! euca-describe-volumes $VOLUME | grep -q available; do sleep 1; done"; then if ! timeout $ASSOCIATE_TIMEOUT sh -c "while ! euca-describe-volumes $VOLUME | grep -q available; do sleep 1; done"; then