blob: 328d5762fcd42297ba3e07d84853e9fc35dcc684 [file] [log] [blame]
James E. Blair92e81992011-10-11 09:26:29 -05001#!/usr/bin/env bash
Dean Troyere62ba4d2012-06-27 22:07:34 -05002
3# **build_bm_multi.sh**
4
James E. Blair92e81992011-10-11 09:26:29 -05005# Build an OpenStack install on several bare metal machines.
6SHELL_AFTER_RUN=no
7
8# Variables common amongst all hosts in the cluster
Dean Troyerb3236912013-03-17 15:17:05 -05009COMMON_VARS="MYSQL_HOST=$HEAD_HOST RABBIT_HOST=$HEAD_HOST GLANCE_HOSTPORT=$HEAD_HOST:9292 NETWORK_MANAGER=FlatDHCPManager FLAT_INTERFACE=eth0 FLOATING_RANGE=$FLOATING_RANGE MULTI_HOST=1 SHELL_AFTER_RUN=$SHELL_AFTER_RUN"
James E. Blair92e81992011-10-11 09:26:29 -050010
11# Helper to launch containers
12function run_bm {
13 # For some reason container names with periods can cause issues :/
14 CONTAINER=$1 CONTAINER_IP=$2 CONTAINER_NETMASK=$NETMASK CONTAINER_GATEWAY=$GATEWAY NAMESERVER=$NAMESERVER TERMINATE=$TERMINATE STACKSH_PARAMS="$COMMON_VARS $3" ./tools/build_bm.sh
15}
16
17# Launch the head node - headnode uses a non-ip domain name,
18# because rabbit won't launch with an ip addr hostname :(
Tres Henryca85b792011-10-28 14:00:21 -070019run_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 -050020
21# Wait till the head node is up
22if [ ! "$TERMINATE" = "1" ]; then
23 echo "Waiting for head node ($HEAD_HOST) to start..."
James E. Blair7057ae92011-10-20 12:23:50 -050024 if ! timeout 60 sh -c "while ! wget -q -O- http://$HEAD_HOST | grep -q username; do sleep 1; done"; then
Sean Dague0b865a52013-10-22 11:37:35 -040025 echo "Head node did not start"
26 exit 1
James E. Blair92e81992011-10-11 09:26:29 -050027 fi
28fi
29
30PIDS=""
31# Launch the compute hosts in parallel
32for compute_host in ${COMPUTE_HOSTS//,/ }; do
33 run_bm $compute_host $compute_host "ENABLED_SERVICES=n-cpu,n-net,n-api" &
34 PIDS="$PIDS $!"
35done
36
37for x in $PIDS; do
38 wait $x
39done
40echo "build_bm_multi complete"