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