Renuka Apte | e98cc12 | 2012-01-26 11:58:56 -0800 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | # Echo commands |
| 4 | set -o xtrace |
| 5 | |
| 6 | # Head node host, which runs glance, api, keystone |
| 7 | HEAD_PUB_IP=${HEAD_PUB_IP:-192.168.1.57} |
| 8 | HEAD_MGT_IP=${HEAD_MGT_IP:-172.16.100.57} |
| 9 | |
| 10 | COMPUTE_PUB_IP=${COMPUTE_PUB_IP:-192.168.1.58} |
| 11 | COMPUTE_MGT_IP=${COMPUTE_MGT_IP:-172.16.100.58} |
| 12 | |
| 13 | # Networking params |
| 14 | FLOATING_RANGE=${FLOATING_RANGE:-192.168.1.196/30} |
| 15 | |
| 16 | # Variables common amongst all hosts in the cluster |
| 17 | COMMON_VARS="$STACKSH_PARAMS MYSQL_HOST=$HEAD_MGT_IP RABBIT_HOST=$HEAD_MGT_IP GLANCE_HOSTPORT=$HEAD_MGT_IP:9292 FLOATING_RANGE=$FLOATING_RANGE" |
| 18 | |
| 19 | # Helper to launch containers |
| 20 | function install_domU { |
| 21 | GUEST_NAME=$1 PUB_IP=$2 MGT_IP=$3 DO_SHUTDOWN=$4 TERMINATE=$TERMINATE STACKSH_PARAMS="$COMMON_VARS $5" ./build_domU.sh |
| 22 | } |
| 23 | |
| 24 | # Launch the head node - headnode uses a non-ip domain name, |
| 25 | # because rabbit won't launch with an ip addr hostname :( |
| 26 | install_domU HEADNODE $HEAD_PUB_IP $HEAD_MGT_IP 1 "ENABLED_SERVICES=g-api,g-reg,key,n-api,n-sch,n-vnc,horizon,mysql,rabbit" |
| 27 | |
| 28 | if [ $HEAD_PUB_IP == "dhcp" ] |
| 29 | then |
| 30 | guestnet=$(xe vm-list --minimal name-label=HEADNODE params=networks) |
| 31 | HEAD_PUB_IP=$(echo $guestnet | grep -w -o --only-matching "3/ip: [0-9,.]*;" | cut -d ':' -f2 | cut -d ';' -f 1) |
| 32 | fi |
| 33 | # Wait till the head node is up |
| 34 | while ! curl -L http://$HEAD_PUB_IP | grep -q username; do |
| 35 | echo "Waiting for head node ($HEAD_PUB_IP) to start..." |
| 36 | sleep 5 |
| 37 | done |
| 38 | |
| 39 | # Build the HA compute host |
| 40 | install_domU COMPUTENODE $COMPUTE_PUB_IP $COMPUTE_MGT_IP 0 "ENABLED_SERVICES=n-cpu,n-net,n-api" |