| James E. Blair | 92e8199 | 2011-10-11 09:26:29 -0500 | [diff] [blame] | 1 | #!/usr/bin/env bash | 
|  | 2 | # Build an OpenStack install on several bare metal machines. | 
|  | 3 | SHELL_AFTER_RUN=no | 
|  | 4 |  | 
|  | 5 | # Variables common amongst all hosts in the cluster | 
|  | 6 | COMMON_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 | 
|  | 9 | function 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 Henry | ca85b79 | 2011-10-28 14:00:21 -0700 | [diff] [blame] | 16 | run_bm STACKMASTER $HEAD_HOST "ENABLED_SERVICES=g-api,g-reg,key,n-api,n-sch,n-vnc,horizon,mysql,rabbit" | 
| James E. Blair | 92e8199 | 2011-10-11 09:26:29 -0500 | [diff] [blame] | 17 |  | 
|  | 18 | # Wait till the head node is up | 
|  | 19 | if [ ! "$TERMINATE" = "1" ]; then | 
|  | 20 | echo "Waiting for head node ($HEAD_HOST) to start..." | 
| James E. Blair | 7057ae9 | 2011-10-20 12:23:50 -0500 | [diff] [blame] | 21 | if ! timeout 60 sh -c "while ! wget -q -O- http://$HEAD_HOST | grep -q username; do sleep 1; done"; then | 
| James E. Blair | 92e8199 | 2011-10-11 09:26:29 -0500 | [diff] [blame] | 22 | echo "Head node did not start" | 
|  | 23 | exit 1 | 
|  | 24 | fi | 
|  | 25 | fi | 
|  | 26 |  | 
|  | 27 | PIDS="" | 
|  | 28 | # Launch the compute hosts in parallel | 
|  | 29 | for compute_host in ${COMPUTE_HOSTS//,/ }; do | 
|  | 30 | run_bm $compute_host $compute_host "ENABLED_SERVICES=n-cpu,n-net,n-api" & | 
|  | 31 | PIDS="$PIDS $!" | 
|  | 32 | done | 
|  | 33 |  | 
|  | 34 | for x in $PIDS; do | 
|  | 35 | wait $x | 
|  | 36 | done | 
|  | 37 | echo "build_bm_multi complete" |