Due to glance changes, it has a very simplistic method of getting the image url.
Change-Id: Ia1e524b049d8efddffa0461e14c0e2bb80c1812c
| ... | ... |
@@ -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) |
| ... | ... |
@@ -37,44 +34,26 @@ TOP_DIR=$(cd $TOOLS_DIR/..; pwd) |
| 37 | 37 |
|
| 38 | 38 |
# Abort if localrc is not set |
| 39 | 39 |
if [ ! -e $TOP_DIR/localrc ]; then |
| 40 |
- echo "You must have a localrc with ALL necessary passwords and configuration defined before proceeding." |
|
| 41 |
- echo "See stack.sh for required passwords." |
|
| 40 |
+ echo "You must have a localrc with necessary basic configuration defined before proceeding." |
|
| 42 | 41 |
exit 1 |
| 43 | 42 |
fi |
| 44 | 43 |
|
| 45 |
-# Source params |
|
| 46 |
-source ./stackrc |
|
| 44 |
+# Abort if openrc is not set |
|
| 45 |
+if [ ! -e $TOP_DIR/openrc ]; then |
|
| 46 |
+ echo "You must have an openrc with ALL necessary passwords and credentials defined before proceeding." |
|
| 47 |
+ exit 1 |
|
| 48 |
+fi |
|
| 47 | 49 |
|
| 48 |
-# Set defaults not configured by stackrc |
|
| 49 |
-TENANT=${TENANT:-admin}
|
|
| 50 |
-USERNAME=${USERNAME:-admin}
|
|
| 51 |
-IDENTITY_HOST=${IDENTITY_HOST:-$HOST_IP}
|
|
| 52 |
-IDENTITY_PORT=${IDENTITY_PORT:-5000}
|
|
| 53 |
-IDENTITY_API_VERSION=${IDENTITY_API_VERSION:-2.0}
|
|
| 50 |
+# Source params |
|
| 51 |
+source $TOP_DIR/openrc |
|
| 54 | 52 |
|
| 55 | 53 |
# Where Openstack code lives |
| 56 | 54 |
DEST=${DEST:-/opt/stack}
|
| 57 | 55 |
|
| 58 | 56 |
TEMPEST_DIR=$DEST/tempest |
| 59 |
- |
|
| 60 |
-CONFIG_DIR=${1:-$TEMPEST_DIR/etc}
|
|
| 61 |
-CONFIG_INI=$CONFIG_DIR/config.ini |
|
| 57 |
+CONFIG_DIR=$TEMPEST_DIR/etc |
|
| 62 | 58 |
TEMPEST_CONF=$CONFIG_DIR/tempest.conf |
| 63 | 59 |
|
| 64 |
-if [ ! -f $DEST/.ramdisk ]; then |
|
| 65 |
- # Process network configuration vars |
|
| 66 |
- GUEST_NETWORK=${GUEST_NETWORK:-1}
|
|
| 67 |
- GUEST_RECREATE_NET=${GUEST_RECREATE_NET:-yes}
|
|
| 68 |
- |
|
| 69 |
- GUEST_IP=${GUEST_IP:-192.168.$GUEST_NETWORK.50}
|
|
| 70 |
- GUEST_CIDR=${GUEST_CIDR:-$GUEST_IP/24}
|
|
| 71 |
- GUEST_NETMASK=${GUEST_NETMASK:-255.255.255.0}
|
|
| 72 |
- GUEST_GATEWAY=${GUEST_GATEWAY:-192.168.$GUEST_NETWORK.1}
|
|
| 73 |
- GUEST_MAC=${GUEST_MAC:-"02:16:3e:07:69:`printf '%02X' $GUEST_NETWORK`"}
|
|
| 74 |
- GUEST_RAM=${GUEST_RAM:-1524288}
|
|
| 75 |
- GUEST_CORES=${GUEST_CORES:-1}
|
|
| 76 |
-fi |
|
| 77 |
- |
|
| 78 | 60 |
# Use the GUEST_IP unless an explicit IP is set by ``HOST_IP`` |
| 79 | 61 |
HOST_IP=${HOST_IP:-$GUEST_IP}
|
| 80 | 62 |
# Use the first IP if HOST_IP still is not set |
| ... | ... |
@@ -82,58 +61,25 @@ if [ ! -n "$HOST_IP" ]; then |
| 82 | 82 |
HOST_IP=`LC_ALL=C /sbin/ifconfig | grep -m 1 'inet addr:'| cut -d: -f2 | awk '{print $1}'`
|
| 83 | 83 |
fi |
| 84 | 84 |
|
| 85 |
-RABBIT_HOST=${RABBIT_HOST:-localhost}
|
|
| 86 |
- |
|
| 87 |
-# Glance connection info. Note the port must be specified. |
|
| 88 |
-GLANCE_HOSTPORT=${GLANCE_HOSTPORT:-$HOST_IP:9292}
|
|
| 89 |
-set `echo $GLANCE_HOSTPORT | tr ':' ' '` |
|
| 90 |
-GLANCE_HOST=$1 |
|
| 91 |
-GLANCE_PORT=$2 |
|
| 92 |
- |
|
| 93 |
-# Set up downloaded images |
|
| 94 |
-# Defaults to use first image |
|
| 95 |
- |
|
| 96 |
-IMAGE_DIR="" |
|
| 97 |
-IMAGE_NAME="" |
|
| 98 |
-for imagedir in $TOP_DIR/files/images/*; do |
|
| 99 |
- KERNEL="" |
|
| 100 |
- RAMDISK="" |
|
| 101 |
- IMAGE="" |
|
| 102 |
- IMAGE_RAMDISK="" |
|
| 103 |
- KERNEL=$(for f in "$imagedir/"*-vmlinuz*; do |
|
| 104 |
- [ -f "$f" ] && echo "$f" && break; done; true) |
|
| 105 |
- [ -n "$KERNEL" ] && ln -sf $KERNEL $imagedir/kernel |
|
| 106 |
- RAMDISK=$(for f in "$imagedir/"*-initrd*; do |
|
| 107 |
- [ -f "$f" ] && echo "$f" && break; done; true) |
|
| 108 |
- [ -n "$RAMDISK" ] && ln -sf $RAMDISK $imagedir/ramdisk && \ |
|
| 109 |
- IMAGE_RAMDISK="ari_location = $imagedir/ramdisk" |
|
| 110 |
- IMAGE=$(for f in "$imagedir/"*.img; do |
|
| 111 |
- [ -f "$f" ] && echo "$f" && break; done; true) |
|
| 112 |
- if [ -n "$IMAGE" ]; then |
|
| 113 |
- ln -sf $IMAGE $imagedir/disk |
|
| 114 |
- # Save the first image directory that contains a disk image link |
|
| 115 |
- if [ -z "$IMAGE_DIR" ]; then |
|
| 116 |
- IMAGE_DIR=$imagedir |
|
| 117 |
- IMAGE_NAME=$(basename ${IMAGE%.img})
|
|
| 118 |
- fi |
|
| 119 |
- fi |
|
| 120 |
-done |
|
| 121 |
-if [[ -n "$IMAGE_NAME" ]]; then |
|
| 122 |
- # Get the image UUID |
|
| 123 |
- IMAGE_UUID=$(nova image-list | grep " $IMAGE_NAME " | cut -d'|' -f2) |
|
| 124 |
- # Strip spaces off |
|
| 125 |
- IMAGE_UUID=$(echo $IMAGE_UUID) |
|
| 85 |
+# Hacky way of getting first ami image |
|
| 86 |
+IMAGE_UUID=`glance index | egrep ami | head -1 | cut -d" " -f1` |
|
| 87 |
+IMAGE_UUID_ALT=$IMAGE_UUID |
|
| 88 |
+if [[ $NUM_IMAGES -gt 1 ]]; then |
|
| 89 |
+ IMAGE_UUID_ALT=${IMAGES[1]}
|
|
| 126 | 90 |
fi |
| 127 | 91 |
|
| 128 | 92 |
# Create tempest.conf from tempest.conf.tpl |
| 93 |
+# copy every time, because the image UUIDS are going to change |
|
| 94 |
+cp $TEMPEST_CONF.tpl $TEMPEST_CONF |
|
| 129 | 95 |
|
| 130 |
-if [[ ! -r $TEMPEST_CONF ]]; then |
|
| 131 |
- cp $TEMPEST_CONF.tpl $TEMPEST_CONF |
|
| 132 |
-fi |
|
| 96 |
+ADMIN_USERNAME=${ADMIN_USERNAME:-admin}
|
|
| 97 |
+ADMIN_PASSWORD=${ADMIN_PASSWORD:-secrete}
|
|
| 98 |
+ADMIN_TENANT_NAME=${ADMIN_TENANT:-admin}
|
|
| 133 | 99 |
|
| 134 | 100 |
IDENTITY_USE_SSL=${IDENTITY_USE_SSL:-False}
|
| 101 |
+IDENTITY_HOST=${IDENTITY_HOST:-127.0.0.1}
|
|
| 135 | 102 |
IDENTITY_PORT=${IDENTITY_PORT:-5000}
|
| 136 |
-IDENTITY_API_VERSION={$IDENTITY_API_VERSION:-v2.0} # Note: need v for now...
|
|
| 103 |
+IDENTITY_API_VERSION="v2.0" # Note: need v for now... |
|
| 137 | 104 |
# TODO(jaypipes): This is dumb and needs to be removed |
| 138 | 105 |
# from the Tempest configuration file entirely... |
| 139 | 106 |
IDENTITY_PATH=${IDENTITY_PATH:-tokens}
|
| ... | ... |
@@ -144,35 +90,34 @@ IDENTITY_STRATEGY=${IDENTITY_STRATEGY:-keystone}
|
| 144 | 144 |
# OS_USERNAME et all should be defined in openrc. |
| 145 | 145 |
OS_USERNAME=${OS_USERNAME:-demo}
|
| 146 | 146 |
OS_TENANT_NAME=${OS_TENANT_NAME:-demo}
|
| 147 |
-OS_PASSWORD=${OS_PASSWORD:-secrete}
|
|
| 147 |
+OS_PASSWORD=${OS_PASSWORD:$ADMIN_PASSWORD}
|
|
| 148 | 148 |
|
| 149 |
-# TODO(jaypipes): Support multiple regular user accounts instead |
|
| 150 |
-# of using the same regular user account for the alternate user... |
|
| 151 |
-ALT_USERNAME=$OS_USERNAME |
|
| 149 |
+# See files/keystone_data.sh where alt_demo user |
|
| 150 |
+# and tenant are set up... |
|
| 151 |
+ALT_USERNAME=${ALT_USERNAME:-alt_demo}
|
|
| 152 |
+ALT_TENANT_NAME=${ALT_TENANT_NAME:-alt_demo}
|
|
| 152 | 153 |
ALT_PASSWORD=$OS_PASSWORD |
| 153 |
-ALT_TENANT_NAME=$OS_TENANT_NAME |
|
| 154 |
- |
|
| 155 |
-# TODO(jaypipes): Support multiple images instead of plopping |
|
| 156 |
-# the IMAGE_UUID into both the image_ref and image_ref_alt slots |
|
| 157 |
-IMAGE_UUID_ALT=$IMAGE_UUID |
|
| 158 | 154 |
|
| 159 | 155 |
# TODO(jaypipes): Support configurable flavor refs here... |
| 160 | 156 |
FLAVOR_REF=1 |
| 161 | 157 |
FLAVOR_REF_ALT=2 |
| 162 | 158 |
|
| 163 |
-ADMIN_USERNAME={$ADMIN_USERNAME:-admin}
|
|
| 164 |
-ADMIN_PASSWORD={$ADMIN_PASSWORD:-secrete}
|
|
| 165 |
-ADMIN_TENANT_NAME={$ADMIN_TENANT:-admin}
|
|
| 166 |
- |
|
| 167 | 159 |
# Do any of the following need to be configurable? |
| 168 | 160 |
COMPUTE_CATALOG_TYPE=compute |
| 169 | 161 |
COMPUTE_CREATE_IMAGE_ENABLED=True |
| 170 |
-COMPUTE_RESIZE_AVAILABLE=True |
|
| 162 |
+COMPUTE_RESIZE_AVAILABLE=False # not supported with QEMU... |
|
| 171 | 163 |
COMPUTE_LOG_LEVEL=ERROR |
| 164 |
+BUILD_INTERVAL=10 |
|
| 165 |
+BUILD_TIMEOUT=600 |
|
| 166 |
+ |
|
| 167 |
+# Image test configuration options... |
|
| 168 |
+IMAGE_HOST=${IMAGE_HOST:-127.0.0.1}
|
|
| 169 |
+IMAGE_PORT=${IMAGE_PORT:-9292}
|
|
| 170 |
+IMAGE_API_VERSION="1" |
|
| 172 | 171 |
|
| 173 | 172 |
sed -e " |
| 174 | 173 |
s,%IDENTITY_USE_SSL%,$IDENTITY_USE_SSL,g; |
| 175 |
- s,%IDENTITY_HOST%,$HOST_IP,g; |
|
| 174 |
+ s,%IDENTITY_HOST%,$IDENTITY_HOST,g; |
|
| 176 | 175 |
s,%IDENTITY_PORT%,$IDENTITY_PORT,g; |
| 177 | 176 |
s,%IDENTITY_API_VERSION%,$IDENTITY_API_VERSION,g; |
| 178 | 177 |
s,%IDENTITY_PATH%,$IDENTITY_PATH,g; |
| ... | ... |
@@ -187,97 +132,24 @@ sed -e " |
| 187 | 187 |
s,%COMPUTE_CREATE_IMAGE_ENABLED%,$COMPUTE_CREATE_IMAGE_ENABLED,g; |
| 188 | 188 |
s,%COMPUTE_RESIZE_AVAILABLE%,$COMPUTE_RESIZE_AVAILABLE,g; |
| 189 | 189 |
s,%COMPUTE_LOG_LEVEL%,$COMPUTE_LOG_LEVEL,g; |
| 190 |
+ s,%BUILD_INTERVAL%,$BUILD_INTERVAL,g; |
|
| 191 |
+ s,%BUILD_TIMEOUT%,$BUILD_TIMEOUT,g; |
|
| 190 | 192 |
s,%IMAGE_ID%,$IMAGE_UUID,g; |
| 191 | 193 |
s,%IMAGE_ID_ALT%,$IMAGE_UUID_ALT,g; |
| 192 | 194 |
s,%FLAVOR_REF%,$FLAVOR_REF,g; |
| 193 | 195 |
s,%FLAVOR_REF_ALT%,$FLAVOR_REF_ALT,g; |
| 196 |
+ s,%IMAGE_HOST%,$IMAGE_HOST,g; |
|
| 197 |
+ s,%IMAGE_PORT%,$IMAGE_PORT,g; |
|
| 198 |
+ s,%IMAGE_API_VERSION%,$IMAGE_API_VERSION,g; |
|
| 194 | 199 |
s,%ADMIN_USERNAME%,$ADMIN_USERNAME,g; |
| 195 | 200 |
s,%ADMIN_PASSWORD%,$ADMIN_PASSWORD,g; |
| 196 | 201 |
s,%ADMIN_TENANT_NAME%,$ADMIN_TENANT_NAME,g; |
| 197 | 202 |
" -i $TEMPEST_CONF |
| 198 | 203 |
|
| 199 |
-# Create config.ini |
|
| 200 |
- |
|
| 201 |
-CONFIG_INI_TMP=$(mktemp $CONFIG_INI.XXXXXX) |
|
| 202 |
-if [ "$UPLOAD_LEGACY_TTY" ]; then |
|
| 203 |
- cat >$CONFIG_INI_TMP <<EOF |
|
| 204 |
-[environment] |
|
| 205 |
-aki_location = $TOP_DIR/files/images/aki-tty/image |
|
| 206 |
-ari_location = $TOP_DIR/files/images/ari-tty/image |
|
| 207 |
-ami_location = $TOP_DIR/files/images/ami-tty/image |
|
| 208 |
-image_ref = 3 |
|
| 209 |
-image_ref_alt = 3 |
|
| 210 |
-flavor_ref = 1 |
|
| 211 |
-flavor_ref_alt = 2 |
|
| 212 |
- |
|
| 213 |
-[glance] |
|
| 214 |
-host = $GLANCE_HOST |
|
| 215 |
-apiver = v1 |
|
| 216 |
-port = $GLANCE_PORT |
|
| 217 |
-image_id = 3 |
|
| 218 |
-image_id_alt = 3 |
|
| 219 |
-tenant_id = 1 |
|
| 220 |
-EOF |
|
| 221 |
-else |
|
| 222 |
- cat >$CONFIG_INI_TMP <<EOF |
|
| 223 |
-[environment] |
|
| 224 |
-aki_location = $IMAGE_DIR/kernel |
|
| 225 |
-ami_location = $IMAGE_DIR/disk |
|
| 226 |
-$IMAGE_RAMDISK |
|
| 227 |
-image_ref = 2 |
|
| 228 |
-image_ref_alt = 2 |
|
| 229 |
-flavor_ref = 1 |
|
| 230 |
-flavor_ref_alt = 2 |
|
| 231 |
- |
|
| 232 |
-[glance] |
|
| 233 |
-host = $GLANCE_HOST |
|
| 234 |
-apiver = v1 |
|
| 235 |
-port = $GLANCE_PORT |
|
| 236 |
-image_id = 2 |
|
| 237 |
-image_id_alt = 2 |
|
| 238 |
-tenant_id = 1 |
|
| 239 |
-EOF |
|
| 240 |
-fi |
|
| 241 |
- |
|
| 242 |
-cat >>$CONFIG_INI_TMP <<EOF |
|
| 243 |
- |
|
| 244 |
-[keystone] |
|
| 245 |
-service_host = $HOST_IP |
|
| 246 |
-service_port = 5000 |
|
| 247 |
-apiver = v2.0 |
|
| 248 |
-user = admin |
|
| 249 |
-password = $ADMIN_PASSWORD |
|
| 250 |
-tenant_name = admin |
|
| 251 |
- |
|
| 252 |
-[nova] |
|
| 253 |
-host = $HOST_IP |
|
| 254 |
-port = 8774 |
|
| 255 |
-apiver = v1.1 |
|
| 256 |
-project = admin |
|
| 257 |
-user = admin |
|
| 258 |
-key = $ADMIN_PASSWORD |
|
| 259 |
-ssh_timeout = 300 |
|
| 260 |
-build_timeout = 300 |
|
| 261 |
-flavor_ref = 1 |
|
| 262 |
-flavor_ref_alt = 2 |
|
| 263 |
-multi_node = no |
|
| 264 |
- |
|
| 265 |
-[rabbitmq] |
|
| 266 |
-host = $RABBIT_HOST |
|
| 267 |
-user = guest |
|
| 268 |
-password = $RABBIT_PASSWORD |
|
| 269 |
- |
|
| 270 |
-[swift] |
|
| 271 |
-auth_host = $HOST_IP |
|
| 272 |
-auth_port = 443 |
|
| 273 |
-auth_prefix = /auth/ |
|
| 274 |
-auth_ssl = yes |
|
| 275 |
-account = system |
|
| 276 |
-username = root |
|
| 277 |
-password = password |
|
| 278 |
- |
|
| 279 |
-EOF |
|
| 280 |
-mv $CONFIG_INI_TMP $CONFIG_INI |
|
| 281 |
-CONFIG_INI_TMP="" |
|
| 204 |
+echo "Created tempest configuration file:" |
|
| 205 |
+cat $TEMPEST_CONF |
|
| 282 | 206 |
|
| 283 |
-trap - SIGHUP SIGINT SIGTERM SIGQUIT EXIT |
|
| 207 |
+echo "\n" |
|
| 208 |
+echo "**************************************************" |
|
| 209 |
+echo "Finished Configuring Tempest" |
|
| 210 |
+echo "**************************************************" |