wait for head node to start before starting compute hosts
diff --git a/build_lxc_multi.sh b/build_lxc_multi.sh
index b26cabf..5a37845 100755
--- a/build_lxc_multi.sh
+++ b/build_lxc_multi.sh
@@ -19,6 +19,13 @@
 # Launch the head node - headnode uses a non-ip domain name,
 # because rabbit won't launch with an ip addr hostname :(
 run_lxc 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
+while ! wget -O - http://$HEAD_HOST | grep -q username; do
+    echo "Waiting for head node ($HEAD_HOST) to start..."
+    sleep 5
+done
+
 for compute_host in ${COMPUTE_HOSTS//,/ }; do
     # Launch the compute hosts
     run_lxc $compute_host $compute_host "ENABLED_SERVICES=n-cpu,n-net,n-api"