* 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
| ... | ... |
@@ -2,10 +2,22 @@ |
| 2 | 2 |
# |
| 3 | 3 |
# configure_tempest.sh - Build a tempest configuration file from devstack |
| 4 | 4 |
|
| 5 |
+echo "**************************************************" |
|
| 6 |
+echo "Configuring Tempest" |
|
| 7 |
+echo "**************************************************" |
|
| 8 |
+ |
|
| 9 |
+# This script exits on an error so that errors don't compound and you see |
|
| 10 |
+# only the first error that occured. |
|
| 11 |
+set -o errexit |
|
| 12 |
+ |
|
| 13 |
+# Print the commands being run so that we can see the command that triggers |
|
| 14 |
+# an error. It is also useful for following allowing as the install occurs. |
|
| 15 |
+set -o xtrace |
|
| 16 |
+ |
|
| 5 | 17 |
function usage {
|
| 6 | 18 |
echo "$0 - Build tempest.conf" |
| 7 | 19 |
echo "" |
| 8 |
- echo "Usage: $0 [configdir]" |
|
| 20 |
+ echo "Usage: $0" |
|
| 9 | 21 |
exit 1 |
| 10 | 22 |
} |
| 11 | 23 |
|
| ... | ... |
@@ -13,21 +25,6 @@ if [ "$1" = "-h" ]; then |
| 13 | 13 |
usage |
| 14 | 14 |
fi |
| 15 | 15 |
|
| 16 |
-# Clean up any resources that may be in use |
|
| 17 |
-cleanup() {
|
|
| 18 |
- set +o errexit |
|
| 19 |
- |
|
| 20 |
- # Mop up temporary files |
|
| 21 |
- if [ -n "$CONFIG_INI_TMP" -a -e "$CONFIG_INI_TMP" ]; then |
|
| 22 |
- rm -f $CONFIG_INI_TMP |
|
| 23 |
- fi |
|
| 24 |
- |
|
| 25 |
- # Kill ourselves to signal any calling process |
|
| 26 |
- trap 2; kill -2 $$ |
|
| 27 |
-} |
|
| 28 |
- |
|
| 29 |
-trap cleanup SIGHUP SIGINT SIGTERM SIGQUIT EXIT |
|
| 30 |
- |
|
| 31 | 16 |
# Keep track of the current directory |
| 32 | 17 |
TOOLS_DIR=$(cd $(dirname "$0") && pwd) |
| 33 | 18 |
TOP_DIR=$(cd $TOOLS_DIR/..; pwd) |
| ... | ... |
@@ -47,39 +44,16 @@ if [ ! -e $TOP_DIR/openrc ]; then |
| 47 | 47 |
exit 1 |
| 48 | 48 |
fi |
| 49 | 49 |
|
| 50 |
-# Source params. openrc sources stackrc which sources localrc |
|
| 50 |
+# Source params |
|
| 51 | 51 |
source $TOP_DIR/openrc |
| 52 | 52 |
|
| 53 |
-# Set defaults not configured by stackrc |
|
| 54 |
-TENANT=${TENANT:-admin}
|
|
| 55 |
-USERNAME=${USERNAME:-admin}
|
|
| 56 |
-IDENTITY_HOST=${IDENTITY_HOST:-$HOST_IP}
|
|
| 57 |
-IDENTITY_PORT=${IDENTITY_PORT:-5000}
|
|
| 58 |
-IDENTITY_API_VERSION=${IDENTITY_API_VERSION:-2.0}
|
|
| 59 |
- |
|
| 60 | 53 |
# Where Openstack code lives |
| 61 | 54 |
DEST=${DEST:-/opt/stack}
|
| 62 | 55 |
|
| 63 | 56 |
TEMPEST_DIR=$DEST/tempest |
| 64 |
- |
|
| 65 |
-CONFIG_DIR=${1:-$TEMPEST_DIR/etc}
|
|
| 66 |
-CONFIG_INI=$CONFIG_DIR/config.ini |
|
| 57 |
+CONFIG_DIR=$TEMPEST_DIR/etc |
|
| 67 | 58 |
TEMPEST_CONF=$CONFIG_DIR/tempest.conf |
| 68 | 59 |
|
| 69 |
-if [ ! -f $DEST/.ramdisk ]; then |
|
| 70 |
- # Process network configuration vars |
|
| 71 |
- GUEST_NETWORK=${GUEST_NETWORK:-1}
|
|
| 72 |
- GUEST_RECREATE_NET=${GUEST_RECREATE_NET:-yes}
|
|
| 73 |
- |
|
| 74 |
- GUEST_IP=${GUEST_IP:-192.168.$GUEST_NETWORK.50}
|
|
| 75 |
- GUEST_CIDR=${GUEST_CIDR:-$GUEST_IP/24}
|
|
| 76 |
- GUEST_NETMASK=${GUEST_NETMASK:-255.255.255.0}
|
|
| 77 |
- GUEST_GATEWAY=${GUEST_GATEWAY:-192.168.$GUEST_NETWORK.1}
|
|
| 78 |
- GUEST_MAC=${GUEST_MAC:-"02:16:3e:07:69:`printf '%02X' $GUEST_NETWORK`"}
|
|
| 79 |
- GUEST_RAM=${GUEST_RAM:-1524288}
|
|
| 80 |
- GUEST_CORES=${GUEST_CORES:-1}
|
|
| 81 |
-fi |
|
| 82 |
- |
|
| 83 | 60 |
# Use the GUEST_IP unless an explicit IP is set by ``HOST_IP`` |
| 84 | 61 |
HOST_IP=${HOST_IP:-$GUEST_IP}
|
| 85 | 62 |
# Use the first IP if HOST_IP still is not set |
| ... | ... |
@@ -87,58 +61,42 @@ if [ ! -n "$HOST_IP" ]; then |
| 87 | 87 |
HOST_IP=`LC_ALL=C /sbin/ifconfig | grep -m 1 'inet addr:'| cut -d: -f2 | awk '{print $1}'`
|
| 88 | 88 |
fi |
| 89 | 89 |
|
| 90 |
-RABBIT_HOST=${RABBIT_HOST:-localhost}
|
|
| 91 |
- |
|
| 92 |
-# Glance connection info. Note the port must be specified. |
|
| 93 |
-GLANCE_HOSTPORT=${GLANCE_HOSTPORT:-$HOST_IP:9292}
|
|
| 94 |
-set `echo $GLANCE_HOSTPORT | tr ':' ' '` |
|
| 95 |
-GLANCE_HOST=$1 |
|
| 96 |
-GLANCE_PORT=$2 |
|
| 97 |
- |
|
| 98 |
-# Set up downloaded images |
|
| 99 |
-# Defaults to use first image |
|
| 100 |
- |
|
| 101 |
-IMAGE_DIR="" |
|
| 102 |
-IMAGE_NAME="" |
|
| 103 |
-for imagedir in $TOP_DIR/files/images/*; do |
|
| 104 |
- KERNEL="" |
|
| 105 |
- RAMDISK="" |
|
| 106 |
- IMAGE="" |
|
| 107 |
- IMAGE_RAMDISK="" |
|
| 108 |
- KERNEL=$(for f in "$imagedir/"*-vmlinuz*; do |
|
| 109 |
- [ -f "$f" ] && echo "$f" && break; done; true) |
|
| 110 |
- [ -n "$KERNEL" ] && ln -sf $KERNEL $imagedir/kernel |
|
| 111 |
- RAMDISK=$(for f in "$imagedir/"*-initrd*; do |
|
| 112 |
- [ -f "$f" ] && echo "$f" && break; done; true) |
|
| 113 |
- [ -n "$RAMDISK" ] && ln -sf $RAMDISK $imagedir/ramdisk && \ |
|
| 114 |
- IMAGE_RAMDISK="ari_location = $imagedir/ramdisk" |
|
| 115 |
- IMAGE=$(for f in "$imagedir/"*.img; do |
|
| 116 |
- [ -f "$f" ] && echo "$f" && break; done; true) |
|
| 117 |
- if [ -n "$IMAGE" ]; then |
|
| 118 |
- ln -sf $IMAGE $imagedir/disk |
|
| 119 |
- # Save the first image directory that contains a disk image link |
|
| 120 |
- if [ -z "$IMAGE_DIR" ]; then |
|
| 121 |
- IMAGE_DIR=$imagedir |
|
| 122 |
- IMAGE_NAME=$(basename ${IMAGE%.img})
|
|
| 123 |
- fi |
|
| 124 |
- fi |
|
| 90 |
+# Glance should already contain images to be used in tempest |
|
| 91 |
+# testing. Here we simply look for images stored in Glance |
|
| 92 |
+# and set the appropriate variables for use in the tempest config |
|
| 93 |
+# We ignore ramdisk and kernel images and set the IMAGE_UUID to |
|
| 94 |
+# the first image returned and set IMAGE_UUID_ALT to the second, |
|
| 95 |
+# if there is more than one returned... |
|
| 96 |
+IMAGE_LINES=`glance index` |
|
| 97 |
+IFS="$(echo -e "\n\r")" |
|
| 98 |
+IMAGES="" |
|
| 99 |
+for line in $IMAGE_LINES; do |
|
| 100 |
+ IMAGES="$IMAGES `echo $line | grep -v "^\(ID\|--\)" | grep -v "\(aki\|ari\)" | cut -d' ' -f1`" |
|
| 125 | 101 |
done |
| 126 |
-if [[ -n "$IMAGE_NAME" ]]; then |
|
| 127 |
- # Get the image UUID |
|
| 128 |
- IMAGE_UUID=$(nova image-list | grep " $IMAGE_NAME " | cut -d'|' -f2) |
|
| 129 |
- # Strip spaces off |
|
| 130 |
- IMAGE_UUID=$(echo $IMAGE_UUID) |
|
| 102 |
+# Create array of image UUIDs... |
|
| 103 |
+IFS=" " |
|
| 104 |
+IMAGES=($IMAGES) |
|
| 105 |
+NUM_IMAGES=${#IMAGES[*]}
|
|
| 106 |
+echo "Found $NUM_IMAGES images" |
|
| 107 |
+if [[ $NUM_IMAGES -eq 0 ]]; then |
|
| 108 |
+ echo "Found no valid images to use!" |
|
| 109 |
+ exit 1 |
|
| 110 |
+fi |
|
| 111 |
+IMAGE_UUID=${IMAGES[0]}
|
|
| 112 |
+IMAGE_UUID_ALT=$IMAGE_UUID |
|
| 113 |
+if [[ $NUM_IMAGES -gt 1 ]]; then |
|
| 114 |
+ IMAGE_UUID_ALT=${IMAGES[1]}
|
|
| 131 | 115 |
fi |
| 132 | 116 |
|
| 133 | 117 |
# Create tempest.conf from tempest.conf.tpl |
| 134 |
- |
|
| 135 | 118 |
if [[ ! -r $TEMPEST_CONF ]]; then |
| 136 | 119 |
cp $TEMPEST_CONF.tpl $TEMPEST_CONF |
| 137 | 120 |
fi |
| 138 | 121 |
|
| 139 | 122 |
IDENTITY_USE_SSL=${IDENTITY_USE_SSL:-False}
|
| 140 |
-TEMPEST_IDENTITY_HOST=${IDENTITY_HOST:-127.0.0.1}
|
|
| 141 |
-TEMPEST_IDENTITY_API_VERSION="v2.0" # Note: need v for now... |
|
| 123 |
+IDENTITY_HOST=${IDENTITY_HOST:-127.0.0.1}
|
|
| 124 |
+IDENTITY_PORT=${IDENTITY_PORT:-5000}
|
|
| 125 |
+IDENTITY_API_VERSION="v2.0" # Note: need v for now... |
|
| 142 | 126 |
# TODO(jaypipes): This is dumb and needs to be removed |
| 143 | 127 |
# from the Tempest configuration file entirely... |
| 144 | 128 |
IDENTITY_PATH=${IDENTITY_PATH:-tokens}
|
| ... | ... |
@@ -157,10 +115,6 @@ ALT_USERNAME=$OS_USERNAME |
| 157 | 157 |
ALT_PASSWORD=$OS_PASSWORD |
| 158 | 158 |
ALT_TENANT_NAME=$OS_TENANT_NAME |
| 159 | 159 |
|
| 160 |
-# TODO(jaypipes): Support multiple images instead of plopping |
|
| 161 |
-# the IMAGE_UUID into both the image_ref and image_ref_alt slots |
|
| 162 |
-IMAGE_UUID_ALT=$IMAGE_UUID |
|
| 163 |
- |
|
| 164 | 160 |
# TODO(jaypipes): Support configurable flavor refs here... |
| 165 | 161 |
FLAVOR_REF=1 |
| 166 | 162 |
FLAVOR_REF_ALT=2 |
| ... | ... |
@@ -179,9 +133,9 @@ BUILD_TIMEOUT=600 |
| 179 | 179 |
|
| 180 | 180 |
sed -e " |
| 181 | 181 |
s,%IDENTITY_USE_SSL%,$IDENTITY_USE_SSL,g; |
| 182 |
- s,%IDENTITY_HOST%,$TEMPEST_IDENTITY_HOST,g; |
|
| 182 |
+ s,%IDENTITY_HOST%,$IDENTITY_HOST,g; |
|
| 183 | 183 |
s,%IDENTITY_PORT%,$IDENTITY_PORT,g; |
| 184 |
- s,%IDENTITY_API_VERSION%,$TEMPEST_IDENTITY_API_VERSION,g; |
|
| 184 |
+ s,%IDENTITY_API_VERSION%,$IDENTITY_API_VERSION,g; |
|
| 185 | 185 |
s,%IDENTITY_PATH%,$IDENTITY_PATH,g; |
| 186 | 186 |
s,%IDENTITY_STRATEGY%,$IDENTITY_STRATEGY,g; |
| 187 | 187 |
s,%USERNAME%,$OS_USERNAME,g; |
| ... | ... |
@@ -207,90 +161,8 @@ sed -e " |
| 207 | 207 |
|
| 208 | 208 |
echo "Created tempest configuration file:" |
| 209 | 209 |
cat $TEMPEST_CONF |
| 210 |
-echo "\n\n" |
|
| 211 |
- |
|
| 212 |
-# Create config.ini |
|
| 213 |
- |
|
| 214 |
-CONFIG_INI_TMP=$(mktemp $CONFIG_INI.XXXXXX) |
|
| 215 |
-if [ "$UPLOAD_LEGACY_TTY" ]; then |
|
| 216 |
- cat >$CONFIG_INI_TMP <<EOF |
|
| 217 |
-[environment] |
|
| 218 |
-aki_location = $TOP_DIR/files/images/aki-tty/image |
|
| 219 |
-ari_location = $TOP_DIR/files/images/ari-tty/image |
|
| 220 |
-ami_location = $TOP_DIR/files/images/ami-tty/image |
|
| 221 |
-image_ref = 3 |
|
| 222 |
-image_ref_alt = 3 |
|
| 223 |
-flavor_ref = 1 |
|
| 224 |
-flavor_ref_alt = 2 |
|
| 225 |
- |
|
| 226 |
-[glance] |
|
| 227 |
-host = $GLANCE_HOST |
|
| 228 |
-apiver = v1 |
|
| 229 |
-port = $GLANCE_PORT |
|
| 230 |
-image_id = 3 |
|
| 231 |
-image_id_alt = 3 |
|
| 232 |
-tenant_id = 1 |
|
| 233 |
-EOF |
|
| 234 |
-else |
|
| 235 |
- cat >$CONFIG_INI_TMP <<EOF |
|
| 236 |
-[environment] |
|
| 237 |
-aki_location = $IMAGE_DIR/kernel |
|
| 238 |
-ami_location = $IMAGE_DIR/disk |
|
| 239 |
-$IMAGE_RAMDISK |
|
| 240 |
-image_ref = 2 |
|
| 241 |
-image_ref_alt = 2 |
|
| 242 |
-flavor_ref = 1 |
|
| 243 |
-flavor_ref_alt = 2 |
|
| 244 |
- |
|
| 245 |
-[glance] |
|
| 246 |
-host = $GLANCE_HOST |
|
| 247 |
-apiver = v1 |
|
| 248 |
-port = $GLANCE_PORT |
|
| 249 |
-image_id = 2 |
|
| 250 |
-image_id_alt = 2 |
|
| 251 |
-tenant_id = 1 |
|
| 252 |
-EOF |
|
| 253 |
-fi |
|
| 254 |
- |
|
| 255 |
-cat >>$CONFIG_INI_TMP <<EOF |
|
| 256 |
- |
|
| 257 |
-[keystone] |
|
| 258 |
-service_host = $HOST_IP |
|
| 259 |
-service_port = 5000 |
|
| 260 |
-apiver = v2.0 |
|
| 261 |
-user = admin |
|
| 262 |
-password = $ADMIN_PASSWORD |
|
| 263 |
-tenant_name = admin |
|
| 264 |
- |
|
| 265 |
-[nova] |
|
| 266 |
-host = $HOST_IP |
|
| 267 |
-port = 8774 |
|
| 268 |
-apiver = v1.1 |
|
| 269 |
-project = admin |
|
| 270 |
-user = admin |
|
| 271 |
-key = $ADMIN_PASSWORD |
|
| 272 |
-ssh_timeout = 300 |
|
| 273 |
-build_timeout = 300 |
|
| 274 |
-flavor_ref = 1 |
|
| 275 |
-flavor_ref_alt = 2 |
|
| 276 |
-multi_node = no |
|
| 277 |
- |
|
| 278 |
-[rabbitmq] |
|
| 279 |
-host = $RABBIT_HOST |
|
| 280 |
-user = guest |
|
| 281 |
-password = $RABBIT_PASSWORD |
|
| 282 |
- |
|
| 283 |
-[swift] |
|
| 284 |
-auth_host = $HOST_IP |
|
| 285 |
-auth_port = 443 |
|
| 286 |
-auth_prefix = /auth/ |
|
| 287 |
-auth_ssl = yes |
|
| 288 |
-account = system |
|
| 289 |
-username = root |
|
| 290 |
-password = password |
|
| 291 |
- |
|
| 292 |
-EOF |
|
| 293 |
-mv $CONFIG_INI_TMP $CONFIG_INI |
|
| 294 |
-CONFIG_INI_TMP="" |
|
| 295 | 210 |
|
| 296 |
-trap - SIGHUP SIGINT SIGTERM SIGQUIT EXIT |
|
| 211 |
+echo "\n" |
|
| 212 |
+echo "**************************************************" |
|
| 213 |
+echo "Finished Configuring Tempest" |
|
| 214 |
+echo "**************************************************" |