Local variable cosmetic changes in lib/tempest

Change-Id: I5e83531c32968bc734abb0f9a8d03e2f9500a074
This commit is contained in:
Attila Fazekas 2012-12-07 14:20:51 +01:00
parent e5f8d1228a
commit 65c0846e37

View File

@ -4,21 +4,21 @@
# ``functions`` file # ``functions`` file
# ``lib/nova`` service is runing # ``lib/nova`` service is runing
# <list other global vars that are assumed to be defined> # <list other global vars that are assumed to be defined>
# - DEST # - ``DEST``
# - ADMIN_PASSWORD # - ``ADMIN_PASSWORD``
# - OS_USERNAME # - ``DEFAULT_IMAGE_NAME``
# - DEFAULT_IMAGE_NAME # - ``S3_SERVICE_PORT``
# - S3_SERVICE_PORT # - ``SERVICE_HOST``
# - SERVICE_HOST # - ``BASE_SQL_CONN`` ``lib/database`` declares
# - BASE_SQL_CONN ``lib/database`` declares
# Optional Dependencies: # Optional Dependencies:
# IDENTITY_* # IDENTITY_USE_SSL, IDENTITY_HOST, IDENTITY_PORT, IDENTITY_PATH
# ALT_* (similar vars exists in keystone_data.sh) # ALT_* (similar vars exists in keystone_data.sh)
# IMAGE_* # ``OS_USERNAME``
# LIVE_MIGRATION_AVAILABLE # ``IMAGE_PORT``, ``IMAGE_HOST``
# DEFAULT_INSTANCE_TYPE # ``LIVE_MIGRATION_AVAILABLE``
# DEFAULT_INSTANCE_USER # ``USE_BLOCK_MIGRATION_FOR_LIVE_MIGRATION``
# USE_BLOCK_MIGRATION_FOR_LIVE_MIGRATION # ``DEFAULT_INSTANCE_TYPE``
# ``DEFAULT_INSTANCE_USER``
# ``stack.sh`` calls the entry points in this order: # ``stack.sh`` calls the entry points in this order:
# #
# install_tempest # install_tempest
@ -52,12 +52,17 @@ BUILD_TIMEOUT=400
# configure_tempest() - Set config files, create data dirs, etc # configure_tempest() - Set config files, create data dirs, etc
function configure_tempest() { function configure_tempest() {
local IMAGE_LINES local image_lines
local IMAGES local images
local NUM_IMAGES local num_images
local IMAGE_UUID local image_uuid
local IMAGE_UUID_ALT local image_uuid_alt
local errexit local errexit
local password
local line
local flavors
local flavors_ref
local flavor_lines
#TODO(afazekas): #TODO(afazekas):
# sudo python setup.py deploy # sudo python setup.py deploy
@ -74,33 +79,33 @@ function configure_tempest() {
# testing. Here we simply look for images stored in Glance # testing. Here we simply look for images stored in Glance
# and set the appropriate variables for use in the tempest config # and set the appropriate variables for use in the tempest config
# We ignore ramdisk and kernel images, look for the default image # We ignore ramdisk and kernel images, look for the default image
# DEFAULT_IMAGE_NAME. If not found, we set the IMAGE_UUID to the # ``DEFAULT_IMAGE_NAME``. If not found, we set the ``image_uuid`` to the
# 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` image_lines=`glance image-list`
IFS=$'\n\r' IFS=$'\n\r'
IMAGES="" images=""
for line in $IMAGE_LINES; do for line in $image_lines; do
if [ -z $DEFAULT_IMAGE_NAME ]; then if [ -z $DEFAULT_IMAGE_NAME ]; then
IMAGES="$IMAGES `echo $line | grep -v "^\(ID\|+--\)" | grep -v "\(aki\|ari\)" | grep 'active' | cut -d' ' -f2`" images="$images `echo $line | grep -v "^\(ID\|+--\)" | grep -v "\(aki\|ari\)" | grep 'active' | cut -d' ' -f2`"
else else
IMAGES="$IMAGES `echo $line | grep -v "^\(ID\|+--\)" | grep -v "\(aki\|ari\)" | grep 'active' | grep "$DEFAULT_IMAGE_NAME" | cut -d' ' -f2`" images="$images `echo $line | grep -v "^\(ID\|+--\)" | grep -v "\(aki\|ari\)" | grep 'active' | grep "$DEFAULT_IMAGE_NAME" | cut -d' ' -f2`"
fi fi
done done
# Create array of image UUIDs... # Create array of image UUIDs...
IFS=" " IFS=" "
IMAGES=($IMAGES) images=($images)
NUM_IMAGES=${#IMAGES[*]} num_images=${#images[*]}
echo "Found $NUM_IMAGES images" echo "Found $num_images images"
if [[ $NUM_IMAGES -eq 0 ]]; then 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 fi
IMAGE_UUID=${IMAGES[0]} image_uuid=${images[0]}
IMAGE_UUID_ALT=$IMAGE_UUID image_uuid_alt=$image_uuid
if [[ $NUM_IMAGES -gt 1 ]]; then if [[ $num_images -gt 1 ]]; then
IMAGE_UUID_ALT=${IMAGES[1]} image_uuid_alt=${images[1]}
fi fi
# Create tempest.conf from tempest.conf.sample # Create tempest.conf from tempest.conf.sample
@ -114,7 +119,7 @@ function configure_tempest() {
# from the Tempest configuration file entirely... # from the Tempest configuration file entirely...
IDENTITY_PATH=${IDENTITY_PATH:-tokens} IDENTITY_PATH=${IDENTITY_PATH:-tokens}
PASSWORD=${ADMIN_PASSWORD:-secrete} password=${ADMIN_PASSWORD:-secrete}
# See files/keystone_data.sh where alt_demo user # See files/keystone_data.sh where alt_demo user
# and tenant are set up... # and tenant are set up...
@ -122,30 +127,30 @@ function configure_tempest() {
ALT_TENANT_NAME=${ALT_TENANT_NAME:-alt_demo} ALT_TENANT_NAME=${ALT_TENANT_NAME:-alt_demo}
# Check Nova for existing flavors and, if set, look for the # Check Nova for existing flavors and, if set, look for the
# DEFAULT_INSTANCE_TYPE and use that. Otherwise, just use the first flavor. # ``DEFAULT_INSTANCE_TYPE`` and use that. Otherwise, just use the first flavor.
FLAVOR_LINES=`nova flavor-list` flavor_lines=`nova flavor-list`
IFS="$(echo -e "\n\r")" IFS=$'\r\n'
FLAVORS="" flavors=""
for line in $FLAVOR_LINES; do for line in $flavor_lines; do
if [ -z $DEFAULT_INSTANCE_TYPE ]; then if [ -z $DEFAULT_INSTANCE_TYPE ]; then
FLAVORS="$FLAVORS `echo $line | grep -v "^\(|\s*ID\|+--\)" | cut -d' ' -f2`" flavors="$flavors `echo $line | grep -v "^\(|\s*ID\|+--\)" | cut -d' ' -f2`"
else else
FLAVORS="$FLAVORS `echo $line | grep -v "^\(|\s*ID\|+--\)" | grep "$DEFAULT_INSTANCE_TYPE" | cut -d' ' -f2`" flavors="$flavors `echo $line | grep -v "^\(|\s*ID\|+--\)" | grep "$DEFAULT_INSTANCE_TYPE" | cut -d' ' -f2`"
fi fi
done done
IFS=" " IFS=" "
FLAVORS=($FLAVORS) flavors=($flavors)
NUM_FLAVORS=${#FLAVORS[*]} num_flavors=${#flavors[*]}
echo "Found $NUM_FLAVORS flavors" echo "Found $num_flavors flavors"
if [[ $NUM_FLAVORS -eq 0 ]]; then if [[ $num_flavors -eq 0 ]]; then
echo "Found no valid flavors to use!" echo "Found no valid flavors to use!"
exit 1 exit 1
fi fi
FLAVOR_REF=${FLAVORS[0]} flavor_ref=${flavors[0]}
FLAVOR_REF_ALT=$FLAVOR_REF flavor_ref_alt=$flavor_ref
if [[ $NUM_FLAVORS -gt 1 ]]; then if [[ $num_flavors -gt 1 ]]; then
FLAVOR_REF_ALT=${FLAVORS[1]} flavor_ref_alt=${flavors[1]}
fi fi
# Timeouts # Timeouts
@ -162,9 +167,9 @@ function configure_tempest() {
iniset $TEMPEST_CONF identity port $IDENTITY_PORT iniset $TEMPEST_CONF identity port $IDENTITY_PORT
iniset $TEMPEST_CONF identity path $IDENTITY_PATH iniset $TEMPEST_CONF identity path $IDENTITY_PATH
iniset $TEMPEST_CONF compute password "$PASSWORD" iniset $TEMPEST_CONF compute password "$password"
iniset $TEMPEST_CONF compute alt_username $ALT_USERNAME iniset $TEMPEST_CONF compute alt_username $ALT_USERNAME
iniset $TEMPEST_CONF compute alt_password "$PASSWORD" iniset $TEMPEST_CONF compute alt_password "$password"
iniset $TEMPEST_CONF compute alt_tenant_name $ALT_TENANT_NAME iniset $TEMPEST_CONF compute alt_tenant_name $ALT_TENANT_NAME
iniset $TEMPEST_CONF compute resize_available False iniset $TEMPEST_CONF compute resize_available False
iniset $TEMPEST_CONF compute change_password_available False iniset $TEMPEST_CONF compute change_password_available False
@ -175,10 +180,10 @@ function configure_tempest() {
iniset $TEMPEST_CONF compute network_for_ssh private iniset $TEMPEST_CONF compute network_for_ssh private
iniset $TEMPEST_CONF compute ip_version_for_ssh 4 iniset $TEMPEST_CONF compute ip_version_for_ssh 4
iniset $TEMPEST_CONF compute ssh_timeout 4 iniset $TEMPEST_CONF compute ssh_timeout 4
iniset $TEMPEST_CONF compute image_ref $IMAGE_UUID iniset $TEMPEST_CONF compute image_ref $image_uuid
iniset $TEMPEST_CONF compute image_ref_alt $IMAGE_UUID_ALT iniset $TEMPEST_CONF compute image_ref_alt $image_uuid_alt
iniset $TEMPEST_CONF compute flavor_ref $FLAVOR_REF iniset $TEMPEST_CONF compute flavor_ref $flavor_ref
iniset $TEMPEST_CONF compute flavor_ref_alt $FLAVOR_REF_ALT iniset $TEMPEST_CONF compute flavor_ref_alt $flavor_ref_alt
iniset $TEMPEST_CONF compute source_dir $NOVA_SOURCE_DIR iniset $TEMPEST_CONF compute source_dir $NOVA_SOURCE_DIR
iniset $TEMPEST_CONF compute live_migration_available ${LIVE_MIGRATION_AVAILABLE:-False} iniset $TEMPEST_CONF compute live_migration_available ${LIVE_MIGRATION_AVAILABLE:-False}
iniset $TEMPEST_CONF compute use_block_migration_for_live_migration ${USE_BLOCK_MIGRATION_FOR_LIVE_MIGRATION:-False} iniset $TEMPEST_CONF compute use_block_migration_for_live_migration ${USE_BLOCK_MIGRATION_FOR_LIVE_MIGRATION:-False}
@ -192,13 +197,13 @@ function configure_tempest() {
# image # image
iniset $TEMPEST_CONF image host ${IMAGE_HOST:-127.0.0.1} iniset $TEMPEST_CONF image host ${IMAGE_HOST:-127.0.0.1}
iniset $TEMPEST_CONF image port ${IMAGE_PORT:-9292} iniset $TEMPEST_CONF image port ${IMAGE_PORT:-9292}
iniset $TEMPEST_CONF image password "$PASSWORD" iniset $TEMPEST_CONF image password "$password"
# identity-admin # identity-admin
iniset $TEMPEST_CONF "identity-admin" password "$PASSWORD" iniset $TEMPEST_CONF "identity-admin" password "$password"
# compute admin # compute admin
iniset $TEMPEST_CONF "compute-admin" password "$PASSWORD" iniset $TEMPEST_CONF "compute-admin" password "$password"
# network # network
iniset $TEMPEST_CONF network api_version 2.0 iniset $TEMPEST_CONF network api_version 2.0