Tempest - Remove Kong support and fix images

* Removes (non-working) Kong config.ini support
* Replaces copy/paste code from stack.sh that was not
  properly grabbing image UUIDs with a call to glance
  index
* Grabs any non-kernel non-ramdisk images and properly populates
  the IMAGE_UUID_ALT variable if more than 1 image is
  available

Change-Id: Ieaf892b8b3fb4ef4fe2e6168f7a53bbe42dd684c
This commit is contained in:
Jay Pipes 2012-04-23 10:56:15 -04:00
parent 45593e2e63
commit 678a188e2d

View File

@ -2,10 +2,22 @@
# #
# configure_tempest.sh - Build a tempest configuration file from devstack # configure_tempest.sh - Build a tempest configuration file from devstack
echo "**************************************************"
echo "Configuring Tempest"
echo "**************************************************"
# This script exits on an error so that errors don't compound and you see
# only the first error that occured.
set -o errexit
# Print the commands being run so that we can see the command that triggers
# an error. It is also useful for following allowing as the install occurs.
set -o xtrace
function usage { function usage {
echo "$0 - Build tempest.conf" echo "$0 - Build tempest.conf"
echo "" echo ""
echo "Usage: $0 [configdir]" echo "Usage: $0"
exit 1 exit 1
} }
@ -13,21 +25,6 @@ if [ "$1" = "-h" ]; then
usage usage
fi fi
# Clean up any resources that may be in use
cleanup() {
set +o errexit
# Mop up temporary files
if [ -n "$CONFIG_INI_TMP" -a -e "$CONFIG_INI_TMP" ]; then
rm -f $CONFIG_INI_TMP
fi
# Kill ourselves to signal any calling process
trap 2; kill -2 $$
}
trap cleanup SIGHUP SIGINT SIGTERM SIGQUIT EXIT
# Keep track of the current directory # Keep track of the current directory
TOOLS_DIR=$(cd $(dirname "$0") && pwd) TOOLS_DIR=$(cd $(dirname "$0") && pwd)
TOP_DIR=$(cd $TOOLS_DIR/..; pwd) TOP_DIR=$(cd $TOOLS_DIR/..; pwd)
@ -47,39 +44,16 @@ if [ ! -e $TOP_DIR/openrc ]; then
exit 1 exit 1
fi fi
# Source params. openrc sources stackrc which sources localrc # Source params
source $TOP_DIR/openrc source $TOP_DIR/openrc
# Set defaults not configured by stackrc
TENANT=${TENANT:-admin}
USERNAME=${USERNAME:-admin}
IDENTITY_HOST=${IDENTITY_HOST:-$HOST_IP}
IDENTITY_PORT=${IDENTITY_PORT:-5000}
IDENTITY_API_VERSION=${IDENTITY_API_VERSION:-2.0}
# Where Openstack code lives # Where Openstack code lives
DEST=${DEST:-/opt/stack} DEST=${DEST:-/opt/stack}
TEMPEST_DIR=$DEST/tempest TEMPEST_DIR=$DEST/tempest
CONFIG_DIR=$TEMPEST_DIR/etc
CONFIG_DIR=${1:-$TEMPEST_DIR/etc}
CONFIG_INI=$CONFIG_DIR/config.ini
TEMPEST_CONF=$CONFIG_DIR/tempest.conf TEMPEST_CONF=$CONFIG_DIR/tempest.conf
if [ ! -f $DEST/.ramdisk ]; then
# Process network configuration vars
GUEST_NETWORK=${GUEST_NETWORK:-1}
GUEST_RECREATE_NET=${GUEST_RECREATE_NET:-yes}
GUEST_IP=${GUEST_IP:-192.168.$GUEST_NETWORK.50}
GUEST_CIDR=${GUEST_CIDR:-$GUEST_IP/24}
GUEST_NETMASK=${GUEST_NETMASK:-255.255.255.0}
GUEST_GATEWAY=${GUEST_GATEWAY:-192.168.$GUEST_NETWORK.1}
GUEST_MAC=${GUEST_MAC:-"02:16:3e:07:69:`printf '%02X' $GUEST_NETWORK`"}
GUEST_RAM=${GUEST_RAM:-1524288}
GUEST_CORES=${GUEST_CORES:-1}
fi
# Use the GUEST_IP unless an explicit IP is set by ``HOST_IP`` # Use the GUEST_IP unless an explicit IP is set by ``HOST_IP``
HOST_IP=${HOST_IP:-$GUEST_IP} HOST_IP=${HOST_IP:-$GUEST_IP}
# Use the first IP if HOST_IP still is not set # Use the first IP if HOST_IP still is not set
@ -87,58 +61,42 @@ if [ ! -n "$HOST_IP" ]; then
HOST_IP=`LC_ALL=C /sbin/ifconfig | grep -m 1 'inet addr:'| cut -d: -f2 | awk '{print $1}'` HOST_IP=`LC_ALL=C /sbin/ifconfig | grep -m 1 'inet addr:'| cut -d: -f2 | awk '{print $1}'`
fi fi
RABBIT_HOST=${RABBIT_HOST:-localhost} # Glance should already contain images to be used in tempest
# testing. Here we simply look for images stored in Glance
# Glance connection info. Note the port must be specified. # and set the appropriate variables for use in the tempest config
GLANCE_HOSTPORT=${GLANCE_HOSTPORT:-$HOST_IP:9292} # We ignore ramdisk and kernel images and set the IMAGE_UUID to
set `echo $GLANCE_HOSTPORT | tr ':' ' '` # the first image returned and set IMAGE_UUID_ALT to the second,
GLANCE_HOST=$1 # if there is more than one returned...
GLANCE_PORT=$2 IMAGE_LINES=`glance index`
IFS="$(echo -e "\n\r")"
# Set up downloaded images IMAGES=""
# Defaults to use first image for line in $IMAGE_LINES; do
IMAGES="$IMAGES `echo $line | grep -v "^\(ID\|--\)" | grep -v "\(aki\|ari\)" | cut -d' ' -f1`"
IMAGE_DIR=""
IMAGE_NAME=""
for imagedir in $TOP_DIR/files/images/*; do
KERNEL=""
RAMDISK=""
IMAGE=""
IMAGE_RAMDISK=""
KERNEL=$(for f in "$imagedir/"*-vmlinuz*; do
[ -f "$f" ] && echo "$f" && break; done; true)
[ -n "$KERNEL" ] && ln -sf $KERNEL $imagedir/kernel
RAMDISK=$(for f in "$imagedir/"*-initrd*; do
[ -f "$f" ] && echo "$f" && break; done; true)
[ -n "$RAMDISK" ] && ln -sf $RAMDISK $imagedir/ramdisk && \
IMAGE_RAMDISK="ari_location = $imagedir/ramdisk"
IMAGE=$(for f in "$imagedir/"*.img; do
[ -f "$f" ] && echo "$f" && break; done; true)
if [ -n "$IMAGE" ]; then
ln -sf $IMAGE $imagedir/disk
# Save the first image directory that contains a disk image link
if [ -z "$IMAGE_DIR" ]; then
IMAGE_DIR=$imagedir
IMAGE_NAME=$(basename ${IMAGE%.img})
fi
fi
done done
if [[ -n "$IMAGE_NAME" ]]; then # Create array of image UUIDs...
# Get the image UUID IFS=" "
IMAGE_UUID=$(nova image-list | grep " $IMAGE_NAME " | cut -d'|' -f2) IMAGES=($IMAGES)
# Strip spaces off NUM_IMAGES=${#IMAGES[*]}
IMAGE_UUID=$(echo $IMAGE_UUID) echo "Found $NUM_IMAGES images"
if [[ $NUM_IMAGES -eq 0 ]]; then
echo "Found no valid images to use!"
exit 1
fi
IMAGE_UUID=${IMAGES[0]}
IMAGE_UUID_ALT=$IMAGE_UUID
if [[ $NUM_IMAGES -gt 1 ]]; then
IMAGE_UUID_ALT=${IMAGES[1]}
fi fi
# Create tempest.conf from tempest.conf.tpl # Create tempest.conf from tempest.conf.tpl
if [[ ! -r $TEMPEST_CONF ]]; then if [[ ! -r $TEMPEST_CONF ]]; then
cp $TEMPEST_CONF.tpl $TEMPEST_CONF cp $TEMPEST_CONF.tpl $TEMPEST_CONF
fi fi
IDENTITY_USE_SSL=${IDENTITY_USE_SSL:-False} IDENTITY_USE_SSL=${IDENTITY_USE_SSL:-False}
TEMPEST_IDENTITY_HOST=${IDENTITY_HOST:-127.0.0.1} IDENTITY_HOST=${IDENTITY_HOST:-127.0.0.1}
TEMPEST_IDENTITY_API_VERSION="v2.0" # Note: need v for now... IDENTITY_PORT=${IDENTITY_PORT:-5000}
IDENTITY_API_VERSION="v2.0" # Note: need v for now...
# TODO(jaypipes): This is dumb and needs to be removed # TODO(jaypipes): This is dumb and needs to be removed
# from the Tempest configuration file entirely... # from the Tempest configuration file entirely...
IDENTITY_PATH=${IDENTITY_PATH:-tokens} IDENTITY_PATH=${IDENTITY_PATH:-tokens}
@ -157,10 +115,6 @@ ALT_USERNAME=$OS_USERNAME
ALT_PASSWORD=$OS_PASSWORD ALT_PASSWORD=$OS_PASSWORD
ALT_TENANT_NAME=$OS_TENANT_NAME ALT_TENANT_NAME=$OS_TENANT_NAME
# TODO(jaypipes): Support multiple images instead of plopping
# the IMAGE_UUID into both the image_ref and image_ref_alt slots
IMAGE_UUID_ALT=$IMAGE_UUID
# TODO(jaypipes): Support configurable flavor refs here... # TODO(jaypipes): Support configurable flavor refs here...
FLAVOR_REF=1 FLAVOR_REF=1
FLAVOR_REF_ALT=2 FLAVOR_REF_ALT=2
@ -179,9 +133,9 @@ BUILD_TIMEOUT=600
sed -e " sed -e "
s,%IDENTITY_USE_SSL%,$IDENTITY_USE_SSL,g; s,%IDENTITY_USE_SSL%,$IDENTITY_USE_SSL,g;
s,%IDENTITY_HOST%,$TEMPEST_IDENTITY_HOST,g; s,%IDENTITY_HOST%,$IDENTITY_HOST,g;
s,%IDENTITY_PORT%,$IDENTITY_PORT,g; s,%IDENTITY_PORT%,$IDENTITY_PORT,g;
s,%IDENTITY_API_VERSION%,$TEMPEST_IDENTITY_API_VERSION,g; s,%IDENTITY_API_VERSION%,$IDENTITY_API_VERSION,g;
s,%IDENTITY_PATH%,$IDENTITY_PATH,g; s,%IDENTITY_PATH%,$IDENTITY_PATH,g;
s,%IDENTITY_STRATEGY%,$IDENTITY_STRATEGY,g; s,%IDENTITY_STRATEGY%,$IDENTITY_STRATEGY,g;
s,%USERNAME%,$OS_USERNAME,g; s,%USERNAME%,$OS_USERNAME,g;
@ -207,90 +161,8 @@ sed -e "
echo "Created tempest configuration file:" echo "Created tempest configuration file:"
cat $TEMPEST_CONF cat $TEMPEST_CONF
echo "\n\n"
# Create config.ini echo "\n"
echo "**************************************************"
CONFIG_INI_TMP=$(mktemp $CONFIG_INI.XXXXXX) echo "Finished Configuring Tempest"
if [ "$UPLOAD_LEGACY_TTY" ]; then echo "**************************************************"
cat >$CONFIG_INI_TMP <<EOF
[environment]
aki_location = $TOP_DIR/files/images/aki-tty/image
ari_location = $TOP_DIR/files/images/ari-tty/image
ami_location = $TOP_DIR/files/images/ami-tty/image
image_ref = 3
image_ref_alt = 3
flavor_ref = 1
flavor_ref_alt = 2
[glance]
host = $GLANCE_HOST
apiver = v1
port = $GLANCE_PORT
image_id = 3
image_id_alt = 3
tenant_id = 1
EOF
else
cat >$CONFIG_INI_TMP <<EOF
[environment]
aki_location = $IMAGE_DIR/kernel
ami_location = $IMAGE_DIR/disk
$IMAGE_RAMDISK
image_ref = 2
image_ref_alt = 2
flavor_ref = 1
flavor_ref_alt = 2
[glance]
host = $GLANCE_HOST
apiver = v1
port = $GLANCE_PORT
image_id = 2
image_id_alt = 2
tenant_id = 1
EOF
fi
cat >>$CONFIG_INI_TMP <<EOF
[keystone]
service_host = $HOST_IP
service_port = 5000
apiver = v2.0
user = admin
password = $ADMIN_PASSWORD
tenant_name = admin
[nova]
host = $HOST_IP
port = 8774
apiver = v1.1
project = admin
user = admin
key = $ADMIN_PASSWORD
ssh_timeout = 300
build_timeout = 300
flavor_ref = 1
flavor_ref_alt = 2
multi_node = no
[rabbitmq]
host = $RABBIT_HOST
user = guest
password = $RABBIT_PASSWORD
[swift]
auth_host = $HOST_IP
auth_port = 443
auth_prefix = /auth/
auth_ssl = yes
account = system
username = root
password = password
EOF
mv $CONFIG_INI_TMP $CONFIG_INI
CONFIG_INI_TMP=""
trap - SIGHUP SIGINT SIGTERM SIGQUIT EXIT