From 67f8b170cb056476569dba3358cb3543e0674134 Mon Sep 17 00:00:00 2001 From: andrea-frittoli Date: Tue, 27 May 2014 14:12:13 +0100 Subject: [PATCH] Make the image name configurable Remove the hardcoded "user" for the image name. Remove the hardcoded container type and format. Change-Id: Id17f3ef8f5b73b4805b29fd1a8d2f23ac7ed0770 --- elements/tempest/bin/run-tempest | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/elements/tempest/bin/run-tempest b/elements/tempest/bin/run-tempest index a4ab2b7cd..87e96326a 100755 --- a/elements/tempest/bin/run-tempest +++ b/elements/tempest/bin/run-tempest @@ -21,6 +21,7 @@ set -o pipefail # Setup the environment TEMPEST_RUN_CONCURRENCY=${TEMPEST_RUN_CONCURRENCY:-0} TEMPEST_ALLOW_TENANT_ISOLATION=${TEMPEST_ALLOW_TENANT_ISOLATION:-true} +TEMPEST_IMAGE_NAME=${TEMPEST_IMAGE_NAME:-user} cd /opt/stack/tempest @@ -37,15 +38,19 @@ keystone user-role-add --user admin --role admin --tenant demo_t1 || true keystone user-role-add --user demo_t1 --role swiftoperator --tenant demo_t1 || true keystone user-role-add --user demo_t2 --role swiftoperator --tenant demo_t2 || true -# We require that a image is present with a name of user -USER_IMAGE_ID=$(nova image-show user | grep id | awk '$2=="id" {print $4}') +# We require that a image is present +USER_IMAGE=$(glance image-show $TEMPEST_IMAGE_NAME) +USER_IMAGE_ID=$(echo "$USER_IMAGE" | awk '$2=="id" {print $4}') +USER_IMAGE_DISK_FORMAT=$(echo "$USER_IMAGE" | awk '$2=="disk_format" {print $4}') +USER_IMAGE_CONTAINER_FORMAT=$(echo "$USER_IMAGE" | awk '$2=="container_format" {print $4}') # And then copy it for tempest test that require a second image -if ! nova image-show user-copy 2> /dev/null ; then - glance image-download user | glance image-create --name user-copy --disk-format qcow2 --container-format bare --is-public 1 +if ! nova image-show ${TEMPEST_IMAGE_NAME}-copy 2> /dev/null ; then + glance image-download ${TEMPEST_IMAGE_NAME} | glance image-create --name ${TEMPEST_IMAGE_NAME}-copy \ + --disk-format $USER_IMAGE_DISK_FORMAT --container-format $USER_IMAGE_CONTAINER_FORMAT --is-public 1 fi -USER_IMAGE_ID2=$(nova image-show user-copy | grep id | awk '$2=="id" {print $4}') +USER_IMAGE_ID2=$(nova image-show ${TEMPEST_IMAGE_NAME}-copy | grep id | awk '$2=="id" {print $4}') EXTNET=$(neutron net-show ext-net | awk '/ id / {print $4}')