blob: 3e07113feeba9ae1bc6ac48aa0558744b6fbd9ff [file] [log] [blame]
Anthony Youngccd4ea32011-11-08 17:25:12 -06001#!/bin/bash
2
3EXECUTOR_NUMBER=$1
4CONFIGURATION=$2
Anthony Young6ecc4f22011-11-09 22:38:48 -08005ADAPTER=$3
Anthony Young053906d2011-11-10 11:38:09 -08006RC=$4
Anthony Youngccd4ea32011-11-08 17:25:12 -06007
8function usage() {
9 echo "Usage: $0 - Build a test configuration"
10 echo ""
Anthony Young053906d2011-11-10 11:38:09 -080011 echo "$0 [EXECUTOR_NUMBER] [CONFIGURATION] [ADAPTER] [RC (optional)]"
Anthony Youngccd4ea32011-11-08 17:25:12 -060012 exit 1
13}
14
15# Validate inputs
Anthony Young0ae5fd02011-11-09 22:39:56 -080016if [[ "$EXECUTOR_NUMBER" = "" || "$CONFIGURATION" = "" || "$ADAPTER" = "" ]]; then
Anthony Youngccd4ea32011-11-08 17:25:12 -060017 usage
18fi
19
20# This directory
21CUR_DIR=$(cd $(dirname "$0") && pwd)
22
23# devstack directory
24cd ../../..
Anthony Young33d2a4e2011-11-10 13:26:16 -080025TOP_DIR=$(pwd)
Anthony Youngccd4ea32011-11-08 17:25:12 -060026
27# Name test instance based on executor
Anthony Young6ecc4f22011-11-09 22:38:48 -080028BASE_NAME=executor-`printf "%02d" $EXECUTOR_NUMBER`
29GUEST_NAME=$BASE_NAME.$ADAPTER
Anthony Youngdbcdf902011-11-10 11:14:16 -080030virsh list | grep $BASE_NAME | cut -d " " -f1 | xargs -n 1 virsh destroy || true
31virsh net-list | grep $BASE_NAME | cut -d " " -f1 | xargs -n 1 virsh net-destroy || true
Anthony Youngccd4ea32011-11-08 17:25:12 -060032
33# Configure localrc
34cat <<EOF >localrc
35RECLONE=yes
36GUEST_NETWORK=$EXECUTOR_NUMBER
Anthony Young6ecc4f22011-11-09 22:38:48 -080037GUEST_NAME=$GUEST_NAME
Anthony Youngccd4ea32011-11-08 17:25:12 -060038FLOATING_RANGE=192.168.$EXECUTOR_NUMBER.128/27
Anthony Youngc8af0c52011-11-11 11:17:47 -080039GUEST_CORES=1
40GUEST_RAM=12574720
Anthony Youngccd4ea32011-11-08 17:25:12 -060041MYSQL_PASSWORD=chicken
42RABBIT_PASSWORD=chicken
43SERVICE_TOKEN=chicken
44ADMIN_PASSWORD=chicken
45USERNAME=admin
46TENANT=admin
Anthony Youngea1a5862011-11-10 11:27:51 -080047NET_NAME=$BASE_NAME
Anthony Young3bff7b32011-11-11 10:51:24 -080048ACTIVE_TIMEOUT=45
49BOOT_TIMEOUT=45
Anthony Young053906d2011-11-10 11:38:09 -080050$RC
Anthony Youngccd4ea32011-11-08 17:25:12 -060051EOF
52cd tools
53sudo ./build_uec.sh
Anthony Youngb2256822011-11-10 12:57:59 -080054
55# Make the address of the instances available to test runners
56echo HEAD=`cat /var/lib/libvirt/dnsmasq/$BASE_NAME.leases | cut -d " " -f3` > $TOP_DIR/addresses