Merge "Fix selection of image(s) tested by tempest."

This commit is contained in:
Jenkins
2013-01-04 19:07:35 +00:00
committed by Gerrit Code Review

View File

@@ -82,30 +82,34 @@ function configure_tempest() {
# first image returned and set ``image_uuid_alt`` to the second, # first image returned and set ``image_uuid_alt`` to the second,
# if there is more than one returned... # if there is more than one returned...
# ... Also ensure we only take active images, so we don't get snapshots in process # ... Also ensure we only take active images, so we don't get snapshots in process
image_lines=`glance image-list` declare -a images
IFS=$'\n\r'
images="" while read -r IMAGE_NAME IMAGE_UUID; do
for line in $image_lines; do if [ "$IMAGE_NAME" = "$DEFAULT_IMAGE_NAME" ]; then
if [ -z $DEFAULT_IMAGE_NAME ]; then image_uuid="$IMAGE_UUID"
images="$images `echo $line | grep -v "^\(ID\|+--\)" | grep -v "\(aki\|ari\)" | grep 'active' | cut -d' ' -f2`" image_uuid_alt="$IMAGE_UUID"
else
images="$images `echo $line | grep -v "^\(ID\|+--\)" | grep -v "\(aki\|ari\)" | grep 'active' | grep "$DEFAULT_IMAGE_NAME" | cut -d' ' -f2`"
fi fi
done images+=($IMAGE_UUID)
# Create array of image UUIDs... done < <(glance image-list --status=active | awk -F'|' '!/^(+--)|ID|aki|ari/ { print $3,$2 }')
IFS=" "
images=($images) case "${#images[*]}" in
num_images=${#images[*]} 0)
echo "Found $num_images images"
if [[ $num_images -eq 0 ]]; then
echo "Found no valid images to use!" echo "Found no valid images to use!"
exit 1 exit 1
fi ;;
1)
if [ -z "$image_uuid" ]; then
image_uuid=${images[0]}
image_uuid_alt=${images[0]}
fi
;;
*)
if [ -z "$image_uuid" ]; then
image_uuid=${images[0]} image_uuid=${images[0]}
image_uuid_alt=$image_uuid
if [[ $num_images -gt 1 ]]; then
image_uuid_alt=${images[1]} image_uuid_alt=${images[1]}
fi fi
;;
esac
# Create tempest.conf from tempest.conf.sample # Create tempest.conf from tempest.conf.sample
# copy every time, because the image UUIDS are going to change # copy every time, because the image UUIDS are going to change