add script that demonstrates separation of head abd compute roles when using xen

This commit is contained in:
Anthony Young 2011-11-05 00:22:47 -05:00
parent 49946a14b5
commit 346e49131b
2 changed files with 49 additions and 9 deletions

View File

@ -226,16 +226,21 @@ mkdir -p /boot/guest
SR_UUID=`xe sr-list --minimal name-label="Local storage"` SR_UUID=`xe sr-list --minimal name-label="Local storage"`
xe sr-param-set uuid=$SR_UUID other-config:i18n-key=local-storage xe sr-param-set uuid=$SR_UUID other-config:i18n-key=local-storage
# Uninstall previous runs
xe vm-list --minimal name-label="$LABEL" | xargs ./scripts/uninstall-os-vpx.sh
# Destroy any instances that were launched # Shutdown previous runs
for uuid in `xe vm-list | grep -1 instance | grep uuid | sed "s/.*\: //g"`; do DO_SHUTDOWN=${DO_SHUTDOWN:-1}
echo "Shutting down nova instance $uuid" if [ "$DO_SHUTDOWN" = "1" ]; then
xe vm-unpause uuid=$uuid || true # Uninstall previous runs
xe vm-shutdown uuid=$uuid xe vm-list --minimal name-label="$LABEL" | xargs ./scripts/uninstall-os-vpx.sh
xe vm-destroy uuid=$uuid
done # Destroy any instances that were launched
for uuid in `xe vm-list | grep -1 instance | grep uuid | sed "s/.*\: //g"`; do
echo "Shutting down nova instance $uuid"
xe vm-unpause uuid=$uuid || true
xe vm-shutdown uuid=$uuid
xe vm-destroy uuid=$uuid
done
fi
# Path to head xva. By default keep overwriting the same one to save space # Path to head xva. By default keep overwriting the same one to save space
USE_SEPARATE_XVAS=${USE_SEPARATE_XVAS:-0} USE_SEPARATE_XVAS=${USE_SEPARATE_XVAS:-0}

35
tools/xen/build_domU_multi.sh Executable file
View File

@ -0,0 +1,35 @@
#!/usr/bin/env bash
# Echo commands
set -o xtrace
# Head node host, which runs glance, api, keystone
HEAD_PUB_IP=${HEAD_PUB_IP:-192.168.1.57}
HEAD_MGT_IP=${HEAD_MGT_IP:-172.16.100.57}
COMPUTE_PUB_IP=${COMPUTE_PUB_IP:-192.168.1.58}
COMPUTE_MGT_IP=${COMPUTE_MGT_IP:-172.16.100.58}
# Networking params
FLOATING_RANGE=${FLOATING_RANGE:-192.168.1.196/30}
# Variables common amongst all hosts in the cluster
COMMON_VARS="$STACKSH_PARAMS MYSQL_HOST=$HEAD_MGT_IP RABBIT_HOST=$HEAD_MGT_IP GLANCE_HOSTPORT=$HEAD_MGT_IP:9292 FLOATING_RANGE=$FLOATING_RANGE"
# Helper to launch containers
function build_domU {
GUEST_NAME=$1 PUB_IP=$2 MGT_IP=$3 DO_SHUTDOWN=$4 TERMINATE=$TERMINATE STACKSH_PARAMS="$COMMON_VARS $5" ./build_domU.sh
}
# Launch the head node - headnode uses a non-ip domain name,
# because rabbit won't launch with an ip addr hostname :(
build_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"
# Wait till the head node is up
while ! curl -L http://$HEAD_PUB_IP | grep -q username; do
echo "Waiting for head node ($HEAD_PUB_IP) to start..."
sleep 5
done
# Build the HA compute host
build_domU $COMPUTE_PUB_IP $COMPUTE_PUB_IP $COMPUTE_MGT_IP 0 "ENABLED_SERVICES=n-cpu,n-net,n-api"