Add timing info to volume exercises.

Looking at some failures lately in Jenkins/Devstack runs and it would
be handy to see if failures were time-out related versus flat out failed
operations.

More interestingly it might be worthwile to harvest the completion time
info from the jenkins logs and keep track of any significant deviations
introduced by code changes.

Change-Id: I3bbcc5b9f8a4da2fcdb9f6f70913c2d6bc6e2b9b
This commit is contained in:
John Griffith 2012-09-26 15:09:52 -06:00
parent c6cc585f97
commit 496ffc74bb

View File

@ -154,10 +154,16 @@ if [[ $? != 0 ]]; then
echo "Failure creating volume $VOL_NAME" echo "Failure creating volume $VOL_NAME"
exit 1 exit 1
fi fi
start_time=`date +%s`
if ! timeout $ACTIVE_TIMEOUT sh -c "while ! nova volume-list | grep $VOL_NAME | grep available; do sleep 1; done"; then if ! timeout $ACTIVE_TIMEOUT sh -c "while ! nova volume-list | grep $VOL_NAME | grep available; do sleep 1; done"; then
echo "Volume $VOL_NAME not created" echo "Volume $VOL_NAME not created"
end_time=`date +%s`
echo "Failed volume-create after $((end_time - start_time)) seconds"
exit 1 exit 1
fi fi
end_time=`date +%s`
echo "Completed volume-create in $((end_time - start_time)) seconds"
# Get volume ID # Get volume ID
VOL_ID=`nova volume-list | grep $VOL_NAME | head -1 | get_field 1` VOL_ID=`nova volume-list | grep $VOL_NAME | head -1 | get_field 1`
@ -165,12 +171,17 @@ die_if_not_set VOL_ID "Failure retrieving volume ID for $VOL_NAME"
# Attach to server # Attach to server
DEVICE=/dev/vdb DEVICE=/dev/vdb
start_time=`date +%s`
nova volume-attach $VM_UUID $VOL_ID $DEVICE || \ nova volume-attach $VM_UUID $VOL_ID $DEVICE || \
die "Failure attaching volume $VOL_NAME to $NAME" die "Failure attaching volume $VOL_NAME to $NAME"
if ! timeout $ACTIVE_TIMEOUT sh -c "while ! nova volume-list | grep $VOL_NAME | grep in-use; do sleep 1; done"; then if ! timeout $ACTIVE_TIMEOUT sh -c "while ! nova volume-list | grep $VOL_NAME | grep in-use; do sleep 1; done"; then
echo "Volume $VOL_NAME not attached to $NAME" echo "Volume $VOL_NAME not attached to $NAME"
end_time=`date +%s`
echo "Failed volume-attach after $((end_time - start_time)) seconds"
exit 1 exit 1
fi fi
end_time=`date +%s`
echo "Completed volume-attach in $((end_time - start_time)) seconds"
VOL_ATTACH=`nova volume-list | grep $VOL_NAME | head -1 | get_field -1` VOL_ATTACH=`nova volume-list | grep $VOL_NAME | head -1 | get_field -1`
die_if_not_set VOL_ATTACH "Failure retrieving $VOL_NAME status" die_if_not_set VOL_ATTACH "Failure retrieving $VOL_NAME status"
@ -180,18 +191,28 @@ if [[ "$VOL_ATTACH" != $VM_UUID ]]; then
fi fi
# Detach volume # Detach volume
start_time=`date +%s`
nova volume-detach $VM_UUID $VOL_ID || die "Failure detaching volume $VOL_NAME from $NAME" nova volume-detach $VM_UUID $VOL_ID || die "Failure detaching volume $VOL_NAME from $NAME"
if ! timeout $ACTIVE_TIMEOUT sh -c "while ! nova volume-list | grep $VOL_NAME | grep available; do sleep 1; done"; then if ! timeout $ACTIVE_TIMEOUT sh -c "while ! nova volume-list | grep $VOL_NAME | grep available; do sleep 1; done"; then
echo "Volume $VOL_NAME not detached from $NAME" echo "Volume $VOL_NAME not detached from $NAME"
end_time=`date +%s`
echo "Failed volume-detach after $((end_time - start_time)) seconds"
exit 1 exit 1
fi fi
end_time=`date +%s`
echo "Completed volume-detach in $((end_time - start_time)) seconds"
# Delete volume # Delete volume
start_time=`date +%s`
nova volume-delete $VOL_ID || die "Failure deleting volume $VOL_NAME" nova volume-delete $VOL_ID || die "Failure deleting volume $VOL_NAME"
if ! timeout $ACTIVE_TIMEOUT sh -c "while ! nova volume-list | grep $VOL_NAME; do sleep 1; done"; then if ! timeout $ACTIVE_TIMEOUT sh -c "while ! nova volume-list | grep $VOL_NAME; do sleep 1; done"; then
echo "Volume $VOL_NAME not deleted" echo "Volume $VOL_NAME not deleted"
end_time=`date +%s`
echo "Failed volume-delete after $((end_time - start_time)) seconds"
exit 1 exit 1
fi fi
end_time=`date +%s`
echo "Completed volume-delete in $((end_time - start_time)) seconds"
# Shutdown the server # Shutdown the server
nova delete $VM_UUID || die "Failure deleting instance $NAME" nova delete $VM_UUID || die "Failure deleting instance $NAME"