devstack_custom/tools/build_bm_multi.sh
James E. Blair 92e81992c1 Add bare-metal build scripts.
Add ROOTSLEEP parameter to avoid 10 second sleep.

Add host argument to mysql password change command so that it
will still work if mysql is already installed and running
(otherwise, the my.cnf created immediately prior takes precedence).

Add timeouts when waiting for things to start so they aren't in
infinite loops.
2011-10-20 11:26:08 -05:00

37 lines
1.4 KiB
Bash
Executable file

#!/usr/bin/env bash
# Build an OpenStack install on several bare metal machines.
SHELL_AFTER_RUN=no
# Variables common amongst all hosts in the cluster
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"
# Helper to launch containers
function run_bm {
# For some reason container names with periods can cause issues :/
CONTAINER=$1 CONTAINER_IP=$2 CONTAINER_NETMASK=$NETMASK CONTAINER_GATEWAY=$GATEWAY NAMESERVER=$NAMESERVER TERMINATE=$TERMINATE STACKSH_PARAMS="$COMMON_VARS $3" ./tools/build_bm.sh
}
# Launch the head node - headnode uses a non-ip domain name,
# because rabbit won't launch with an ip addr hostname :(
run_bm STACKMASTER $HEAD_HOST "ENABLED_SERVICES=g-api,g-reg,key,n-api,n-sch,n-vnc,dash,mysql,rabbit"
# Wait till the head node is up
if [ ! "$TERMINATE" = "1" ]; then
echo "Waiting for head node ($HEAD_HOST) to start..."
if ! timeout 600 sh -c "while ! wget -q -O- http://$HEAD_HOST | grep -q username; do sleep 1; done"; then
echo "Head node did not start"
exit 1
fi
fi
PIDS=""
# Launch the compute hosts in parallel
for compute_host in ${COMPUTE_HOSTS//,/ }; do
run_bm $compute_host $compute_host "ENABLED_SERVICES=n-cpu,n-net,n-api" &
PIDS="$PIDS $!"
done
for x in $PIDS; do
wait $x
done
echo "build_bm_multi complete"