Add volume tests to exercises/euca.sh

Excercise euca2ools volumes commands when
exercising the other euca2ools as well.

Change-Id: Ia43bd233c63224eac5e851b3b8a3dbdbf3b5e1f0
Signed-off-by: Chuck Short <chuck.short@canonical.com>
This commit is contained in:
Chuck Short 2012-08-07 10:38:44 -05:00
parent eab531a053
commit 37258958ce

View File

@ -72,6 +72,48 @@ if ! timeout $RUNNING_TIMEOUT sh -c "while ! euca-describe-instances $INSTANCE |
exit 1
fi
# Volumes
# -------
if [[ "$ENABLED_SERVICES" =~ "n-vol" || "$ENABLED_SERVICES" =~ "c-vol" ]]; then
VOLUME=`euca-create-volume -s 1 -z $VOLUME_ZONE | cut -f2`
die_if_not_set VOLUME "Failure to create volume"
# Test that volume has been created
VOLUME=`euca-describe-volumes | cut -f2`
# Test volume has become available
if ! timeout $ASSOCIATE_TIMEOUT sh -c "while ! euca-describe-volumes $VOLUME | grep -q available; do sleep 1; done"; then
echo "volume didnt become available within $RUNNING_TIMEOUT seconds"
exit 1
fi
# Attach volume to an instance
euca-attach-volume -i $INSTANCE -d $ATTACH_DEVICE $VOLUME || \
die "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
echo "Could not attach $VOLUME to $INSTANCE"
exit 1
fi
# Detach volume from an instance
euca-detach-volume $VOLUME || \
die "Failure detaching volume $VOLUME to $INSTANCE"
if ! timeout $ACTIVE_TIMEOUT sh -c "while ! euca-describe-volumes $VOLUME | grep -q available; do sleep 1; done"; then
echo "Could not detach $VOLUME to $INSTANCE"
exit 1
fi
# Remove volume
euca-delete-volume $VOLUME || \
die "Failure to delete volume"
if ! timeout $ACTIVE_TIMEOUT sh -c "while euca-describe-volumes | grep $VOLUME; do sleep 1; done"; then
echo "Could not delete $VOLUME"
exit 1
fi
else
echo "Volume Tests Skipped"
fi
# Allocate floating address
FLOATING_IP=`euca-allocate-address | cut -f2`
die_if_not_set FLOATING_IP "Failure allocating floating IP"