aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClark Laughlin <clark.laughlin@linaro.org>2014-02-13 10:52:19 -0600
committerClark Laughlin <clark.laughlin@linaro.org>2014-02-13 10:52:19 -0600
commitcbd5d8e0b281985f9f93c98942eb9ab9f20cfebe (patch)
tree122d0cbcc606b9cfa390bcda060a7cce47ed4cc7
parent415ef6c2d41d53f00d1dcdfcdaa109b71aa6c840 (diff)
check variable to allow skipping volume attach/detach test
-rwxr-xr-xexercises/volumes.sh50
1 files changed, 29 insertions, 21 deletions
diff --git a/exercises/volumes.sh b/exercises/volumes.sh
index 21b5d21..258275c 100755
--- a/exercises/volumes.sh
+++ b/exercises/volumes.sh
@@ -168,34 +168,42 @@ echo "Completed cinder create in $((end_time - start_time)) seconds"
VOL_ID=$(cinder list | grep $VOL_NAME | head -1 | get_field 1)
die_if_not_set $LINENO VOL_ID "Failure retrieving volume ID for $VOL_NAME"
-# Attach to server
-DEVICE=/dev/vdb
-start_time=$(date +%s)
-nova volume-attach $VM_UUID $VOL_ID $DEVICE || \
- die $LINENO "Failure attaching volume $VOL_NAME to $VM_NAME"
-if ! timeout $ACTIVE_TIMEOUT sh -c "while ! cinder list | grep $VOL_NAME | grep in-use; do sleep 1; done"; then
- die $LINENO "Volume $VOL_NAME not attached to $VM_NAME"
-fi
-end_time=$(date +%s)
-echo "Completed volume-attach in $((end_time - start_time)) seconds"
+if ! is_set SKIP_VOLUME_ATTACH_TEST; then
+
+ # Attach to server
+ DEVICE=/dev/vdb
+ start_time=$(date +%s)
+ nova volume-attach $VM_UUID $VOL_ID $DEVICE || \
+ die $LINENO "Failure attaching volume $VOL_NAME to $VM_NAME"
+ if ! timeout $ACTIVE_TIMEOUT sh -c "while ! cinder list | grep $VOL_NAME | grep in-use; do sleep 1; done"; then
+ die $LINENO "Volume $VOL_NAME not attached to $VM_NAME"
+ fi
+ end_time=$(date +%s)
+ echo "Completed volume-attach in $((end_time - start_time)) seconds"
+
+ VOL_ATTACH=$(cinder list | grep $VOL_NAME | head -1 | get_field -1)
+ die_if_not_set $LINENO VOL_ATTACH "Failure retrieving $VOL_NAME status"
+ if [[ "$VOL_ATTACH" != $VM_UUID ]]; then
+ die $LINENO "Volume not attached to correct instance"
+ fi
-VOL_ATTACH=$(cinder list | grep $VOL_NAME | head -1 | get_field -1)
-die_if_not_set $LINENO VOL_ATTACH "Failure retrieving $VOL_NAME status"
-if [[ "$VOL_ATTACH" != $VM_UUID ]]; then
- die $LINENO "Volume not attached to correct instance"
fi
# Clean up
# --------
-# Detach volume
-start_time=$(date +%s)
-nova volume-detach $VM_UUID $VOL_ID || die $LINENO "Failure detaching volume $VOL_NAME from $VM_NAME"
-if ! timeout $ACTIVE_TIMEOUT sh -c "while ! cinder list | grep $VOL_NAME | grep available; do sleep 1; done"; then
- die $LINENO "Volume $VOL_NAME not detached from $VM_NAME"
+if ! is_set SKIP_VOLUME_ATTACH_TEST; then
+
+ # Detach volume
+ start_time=$(date +%s)
+ nova volume-detach $VM_UUID $VOL_ID || die $LINENO "Failure detaching volume $VOL_NAME from $VM_NAME"
+ if ! timeout $ACTIVE_TIMEOUT sh -c "while ! cinder list | grep $VOL_NAME | grep available; do sleep 1; done"; then
+ die $LINENO "Volume $VOL_NAME not detached from $VM_NAME"
+ fi
+ end_time=$(date +%s)
+ echo "Completed volume-detach in $((end_time - start_time)) seconds"
+
fi
-end_time=$(date +%s)
-echo "Completed volume-detach in $((end_time - start_time)) seconds"
# Delete volume
start_time=$(date +%s)