blob: 6927fd7c29c96c48119da8a46190b9037c434cfc [file] [log] [blame]
Anthony Youngccd4ea32011-11-08 17:25:12 -06001#!/bin/bash
2
Jesse Andrewsd7326d22011-11-20 10:02:26 -08003# exit on error to stop unexpected errors
4set -o errexit
5set -o xtrace
6
Anthony Youngccd4ea32011-11-08 17:25:12 -06007EXECUTOR_NUMBER=$1
8CONFIGURATION=$2
Anthony Young6ecc4f22011-11-09 22:38:48 -08009ADAPTER=$3
Anthony Young053906d2011-11-10 11:38:09 -080010RC=$4
Anthony Youngccd4ea32011-11-08 17:25:12 -060011
Ian Wienandaee18c72014-02-21 15:35:08 +110012function usage {
Anthony Youngccd4ea32011-11-08 17:25:12 -060013 echo "Usage: $0 - Build a test configuration"
14 echo ""
Anthony Young053906d2011-11-10 11:38:09 -080015 echo "$0 [EXECUTOR_NUMBER] [CONFIGURATION] [ADAPTER] [RC (optional)]"
Anthony Youngccd4ea32011-11-08 17:25:12 -060016 exit 1
17}
18
19# Validate inputs
Anthony Young0ae5fd02011-11-09 22:39:56 -080020if [[ "$EXECUTOR_NUMBER" = "" || "$CONFIGURATION" = "" || "$ADAPTER" = "" ]]; then
Anthony Youngccd4ea32011-11-08 17:25:12 -060021 usage
22fi
23
24# This directory
25CUR_DIR=$(cd $(dirname "$0") && pwd)
26
27# devstack directory
28cd ../../..
Anthony Young33d2a4e2011-11-10 13:26:16 -080029TOP_DIR=$(pwd)
Anthony Youngccd4ea32011-11-08 17:25:12 -060030
Anthony Younga138eaf2011-11-14 12:46:51 -080031# Deps
Jesse Andrewsd7326d22011-11-20 10:02:26 -080032apt-get install -y --force-yes libvirt-bin || true
Anthony Younga138eaf2011-11-14 12:46:51 -080033
Anthony Youngccd4ea32011-11-08 17:25:12 -060034# Name test instance based on executor
Anthony Young6ecc4f22011-11-09 22:38:48 -080035BASE_NAME=executor-`printf "%02d" $EXECUTOR_NUMBER`
36GUEST_NAME=$BASE_NAME.$ADAPTER
Anthony Youngdbcdf902011-11-10 11:14:16 -080037virsh list | grep $BASE_NAME | cut -d " " -f1 | xargs -n 1 virsh destroy || true
38virsh net-list | grep $BASE_NAME | cut -d " " -f1 | xargs -n 1 virsh net-destroy || true
Anthony Youngccd4ea32011-11-08 17:25:12 -060039
40# Configure localrc
41cat <<EOF >localrc
42RECLONE=yes
43GUEST_NETWORK=$EXECUTOR_NUMBER
Anthony Young6ecc4f22011-11-09 22:38:48 -080044GUEST_NAME=$GUEST_NAME
Anthony Youngccd4ea32011-11-08 17:25:12 -060045FLOATING_RANGE=192.168.$EXECUTOR_NUMBER.128/27
Anthony Youngc8af0c52011-11-11 11:17:47 -080046GUEST_CORES=1
47GUEST_RAM=12574720
Anthony Youngccd4ea32011-11-08 17:25:12 -060048MYSQL_PASSWORD=chicken
49RABBIT_PASSWORD=chicken
50SERVICE_TOKEN=chicken
Jesse Andrews9f1891e2012-03-04 23:40:05 -080051SERVICE_PASSWORD=chicken
Anthony Youngccd4ea32011-11-08 17:25:12 -060052ADMIN_PASSWORD=chicken
53USERNAME=admin
54TENANT=admin
Anthony Youngea1a5862011-11-10 11:27:51 -080055NET_NAME=$BASE_NAME
Anthony Young3bff7b32011-11-11 10:51:24 -080056ACTIVE_TIMEOUT=45
57BOOT_TIMEOUT=45
Anthony Young053906d2011-11-10 11:38:09 -080058$RC
Anthony Youngccd4ea32011-11-08 17:25:12 -060059EOF
60cd tools
61sudo ./build_uec.sh
Anthony Youngb2256822011-11-10 12:57:59 -080062
63# Make the address of the instances available to test runners
64echo HEAD=`cat /var/lib/libvirt/dnsmasq/$BASE_NAME.leases | cut -d " " -f3` > $TOP_DIR/addresses