devstack_custom/tools/jenkins/configurations/kvm.sh

57 lines
1.3 KiB
Bash
Raw Normal View History

2011-11-08 23:25:12 +00:00
#!/bin/bash
EXECUTOR_NUMBER=$1
CONFIGURATION=$2
ADAPTER=$3
2011-11-10 19:38:09 +00:00
RC=$4
2011-11-08 23:25:12 +00:00
function usage() {
echo "Usage: $0 - Build a test configuration"
echo ""
2011-11-10 19:38:09 +00:00
echo "$0 [EXECUTOR_NUMBER] [CONFIGURATION] [ADAPTER] [RC (optional)]"
2011-11-08 23:25:12 +00:00
exit 1
}
# Validate inputs
2011-11-10 06:39:56 +00:00
if [[ "$EXECUTOR_NUMBER" = "" || "$CONFIGURATION" = "" || "$ADAPTER" = "" ]]; then
2011-11-08 23:25:12 +00:00
usage
fi
# This directory
CUR_DIR=$(cd $(dirname "$0") && pwd)
# devstack directory
cd ../../..
2011-11-10 21:26:16 +00:00
TOP_DIR=$(pwd)
2011-11-08 23:25:12 +00:00
# Name test instance based on executor
BASE_NAME=executor-`printf "%02d" $EXECUTOR_NUMBER`
GUEST_NAME=$BASE_NAME.$ADAPTER
2011-11-10 19:14:16 +00:00
virsh list | grep $BASE_NAME | cut -d " " -f1 | xargs -n 1 virsh destroy || true
virsh net-list | grep $BASE_NAME | cut -d " " -f1 | xargs -n 1 virsh net-destroy || true
2011-11-08 23:25:12 +00:00
# Configure localrc
cat <<EOF >localrc
RECLONE=yes
GUEST_NETWORK=$EXECUTOR_NUMBER
GUEST_NAME=$GUEST_NAME
2011-11-08 23:25:12 +00:00
FLOATING_RANGE=192.168.$EXECUTOR_NUMBER.128/27
GUEST_CORES=4
2011-11-09 20:20:37 +00:00
GUEST_RAM=1000000
2011-11-08 23:25:12 +00:00
MYSQL_PASSWORD=chicken
RABBIT_PASSWORD=chicken
SERVICE_TOKEN=chicken
ADMIN_PASSWORD=chicken
USERNAME=admin
TENANT=admin
2011-11-10 19:27:51 +00:00
NET_NAME=$BASE_NAME
2011-11-11 18:51:24 +00:00
ACTIVE_TIMEOUT=45
BOOT_TIMEOUT=45
2011-11-10 19:38:09 +00:00
$RC
2011-11-08 23:25:12 +00:00
EOF
cd tools
sudo ./build_uec.sh
# Make the address of the instances available to test runners
echo HEAD=`cat /var/lib/libvirt/dnsmasq/$BASE_NAME.leases | cut -d " " -f3` > $TOP_DIR/addresses