blob: 133d5372cfcafb83e672abf564f9e1d0fc7d1368 [file] [log] [blame]
James E. Blair92e81992011-10-11 09:26:29 -05001#!/usr/bin/env bash
2# Build an OpenStack install on several bare metal machines.
3SHELL_AFTER_RUN=no
4
5# Variables common amongst all hosts in the cluster
6COMMON_VARS="MYSQL_HOST=$HEAD_HOST RABBIT_HOST=$HEAD_HOST GLANCE_HOSTPORT=$HEAD_HOST:9292 NET_MAN=FlatDHCPManager FLAT_INTERFACE=eth0 FLOATING_RANGE=$FLOATING_RANGE MULTI_HOST=1 SHELL_AFTER_RUN=$SHELL_AFTER_RUN"
7
8# Helper to launch containers
9function run_bm {
10 # For some reason container names with periods can cause issues :/
11 CONTAINER=$1 CONTAINER_IP=$2 CONTAINER_NETMASK=$NETMASK CONTAINER_GATEWAY=$GATEWAY NAMESERVER=$NAMESERVER TERMINATE=$TERMINATE STACKSH_PARAMS="$COMMON_VARS $3" ./tools/build_bm.sh
12}
13
14# Launch the head node - headnode uses a non-ip domain name,
15# because rabbit won't launch with an ip addr hostname :(
Tres Henryca85b792011-10-28 14:00:21 -070016run_bm STACKMASTER $HEAD_HOST "ENABLED_SERVICES=g-api,g-reg,key,n-api,n-sch,n-vnc,horizon,mysql,rabbit"
James E. Blair92e81992011-10-11 09:26:29 -050017
18# Wait till the head node is up
19if [ ! "$TERMINATE" = "1" ]; then
20 echo "Waiting for head node ($HEAD_HOST) to start..."
James E. Blair7057ae92011-10-20 12:23:50 -050021 if ! timeout 60 sh -c "while ! wget -q -O- http://$HEAD_HOST | grep -q username; do sleep 1; done"; then
James E. Blair92e81992011-10-11 09:26:29 -050022 echo "Head node did not start"
23 exit 1
24 fi
25fi
26
27PIDS=""
28# Launch the compute hosts in parallel
29for compute_host in ${COMPUTE_HOSTS//,/ }; do
30 run_bm $compute_host $compute_host "ENABLED_SERVICES=n-cpu,n-net,n-api" &
31 PIDS="$PIDS $!"
32done
33
34for x in $PIDS; do
35 wait $x
36done
37echo "build_bm_multi complete"