Skip to content

Commit 678a188

Browse files
committed
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
1 parent 45593e2 commit 678a188

File tree

1 file changed

+48
-176
lines changed

1 file changed

+48
-176
lines changed

tools/configure_tempest.sh

Lines changed: 48 additions & 176 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,29 @@
22
#
33
# configure_tempest.sh - Build a tempest configuration file from devstack
44

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+
517
function usage {
618
echo "$0 - Build tempest.conf"
719
echo ""
8-
echo "Usage: $0 [configdir]"
20+
echo "Usage: $0"
921
exit 1
1022
}
1123

1224
if [ "$1" = "-h" ]; then
1325
usage
1426
fi
1527

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-
3128
# Keep track of the current directory
3229
TOOLS_DIR=$(cd $(dirname "$0") && pwd)
3330
TOP_DIR=$(cd $TOOLS_DIR/..; pwd)
@@ -47,98 +44,59 @@ if [ ! -e $TOP_DIR/openrc ]; then
4744
exit 1
4845
fi
4946

50-
# Source params. openrc sources stackrc which sources localrc
47+
# Source params
5148
source $TOP_DIR/openrc
5249

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-
6050
# Where Openstack code lives
6151
DEST=${DEST:-/opt/stack}
6252

6353
TEMPEST_DIR=$DEST/tempest
64-
65-
CONFIG_DIR=${1:-$TEMPEST_DIR/etc}
66-
CONFIG_INI=$CONFIG_DIR/config.ini
54+
CONFIG_DIR=$TEMPEST_DIR/etc
6755
TEMPEST_CONF=$CONFIG_DIR/tempest.conf
6856

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-
8357
# Use the GUEST_IP unless an explicit IP is set by ``HOST_IP``
8458
HOST_IP=${HOST_IP:-$GUEST_IP}
8559
# Use the first IP if HOST_IP still is not set
8660
if [ ! -n "$HOST_IP" ]; then
8761
HOST_IP=`LC_ALL=C /sbin/ifconfig | grep -m 1 'inet addr:'| cut -d: -f2 | awk '{print $1}'`
8862
fi
8963

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
64+
# Glance should already contain images to be used in tempest
65+
# testing. Here we simply look for images stored in Glance
66+
# and set the appropriate variables for use in the tempest config
67+
# We ignore ramdisk and kernel images and set the IMAGE_UUID to
68+
# the first image returned and set IMAGE_UUID_ALT to the second,
69+
# if there is more than one returned...
70+
IMAGE_LINES=`glance index`
71+
IFS="$(echo -e "\n\r")"
72+
IMAGES=""
73+
for line in $IMAGE_LINES; do
74+
IMAGES="$IMAGES `echo $line | grep -v "^\(ID\|--\)" | grep -v "\(aki\|ari\)" | cut -d' ' -f1`"
12575
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)
76+
# Create array of image UUIDs...
77+
IFS=" "
78+
IMAGES=($IMAGES)
79+
NUM_IMAGES=${#IMAGES[*]}
80+
echo "Found $NUM_IMAGES images"
81+
if [[ $NUM_IMAGES -eq 0 ]]; then
82+
echo "Found no valid images to use!"
83+
exit 1
84+
fi
85+
IMAGE_UUID=${IMAGES[0]}
86+
IMAGE_UUID_ALT=$IMAGE_UUID
87+
if [[ $NUM_IMAGES -gt 1 ]]; then
88+
IMAGE_UUID_ALT=${IMAGES[1]}
13189
fi
13290

13391
# Create tempest.conf from tempest.conf.tpl
134-
13592
if [[ ! -r $TEMPEST_CONF ]]; then
13693
cp $TEMPEST_CONF.tpl $TEMPEST_CONF
13794
fi
13895

13996
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...
97+
IDENTITY_HOST=${IDENTITY_HOST:-127.0.0.1}
98+
IDENTITY_PORT=${IDENTITY_PORT:-5000}
99+
IDENTITY_API_VERSION="v2.0" # Note: need v for now...
142100
# TODO(jaypipes): This is dumb and needs to be removed
143101
# from the Tempest configuration file entirely...
144102
IDENTITY_PATH=${IDENTITY_PATH:-tokens}
@@ -157,10 +115,6 @@ ALT_USERNAME=$OS_USERNAME
157115
ALT_PASSWORD=$OS_PASSWORD
158116
ALT_TENANT_NAME=$OS_TENANT_NAME
159117

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-
164118
# TODO(jaypipes): Support configurable flavor refs here...
165119
FLAVOR_REF=1
166120
FLAVOR_REF_ALT=2
@@ -179,9 +133,9 @@ BUILD_TIMEOUT=600
179133

180134
sed -e "
181135
s,%IDENTITY_USE_SSL%,$IDENTITY_USE_SSL,g;
182-
s,%IDENTITY_HOST%,$TEMPEST_IDENTITY_HOST,g;
136+
s,%IDENTITY_HOST%,$IDENTITY_HOST,g;
183137
s,%IDENTITY_PORT%,$IDENTITY_PORT,g;
184-
s,%IDENTITY_API_VERSION%,$TEMPEST_IDENTITY_API_VERSION,g;
138+
s,%IDENTITY_API_VERSION%,$IDENTITY_API_VERSION,g;
185139
s,%IDENTITY_PATH%,$IDENTITY_PATH,g;
186140
s,%IDENTITY_STRATEGY%,$IDENTITY_STRATEGY,g;
187141
s,%USERNAME%,$OS_USERNAME,g;
@@ -207,90 +161,8 @@ sed -e "
207161

208162
echo "Created tempest configuration file:"
209163
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=""
295164

296-
trap - SIGHUP SIGINT SIGTERM SIGQUIT EXIT
165+
echo "\n"
166+
echo "**************************************************"
167+
echo "Finished Configuring Tempest"
168+
echo "**************************************************"

0 commit comments

Comments
 (0)