Skip to content

Commit 1a5a65f

Browse files
committed
Merge pull request #164 from cloudbuilders/xen_multi
Add script that demonstrates separation of head and compute roles for xen
2 parents 9fc02e0 + 40b5737 commit 1a5a65f

File tree

2 files changed

+50
-10
lines changed

2 files changed

+50
-10
lines changed

tools/xen/build_domU.sh

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -226,16 +226,21 @@ mkdir -p /boot/guest
226226
SR_UUID=`xe sr-list --minimal name-label="Local storage"`
227227
xe sr-param-set uuid=$SR_UUID other-config:i18n-key=local-storage
228228

229-
# Uninstall previous runs
230-
xe vm-list --minimal name-label="$LABEL" | xargs ./scripts/uninstall-os-vpx.sh
231-
232-
# Destroy any instances that were launched
233-
for uuid in `xe vm-list | grep -1 instance | grep uuid | sed "s/.*\: //g"`; do
234-
echo "Shutting down nova instance $uuid"
235-
xe vm-unpause uuid=$uuid || true
236-
xe vm-shutdown uuid=$uuid
237-
xe vm-destroy uuid=$uuid
238-
done
229+
230+
# Shutdown previous runs
231+
DO_SHUTDOWN=${DO_SHUTDOWN:-1}
232+
if [ "$DO_SHUTDOWN" = "1" ]; then
233+
# Shutdown all domU's that created previously
234+
xe vm-list --minimal name-label="$LABEL" | xargs ./scripts/uninstall-os-vpx.sh
235+
236+
# Destroy any instances that were launched
237+
for uuid in `xe vm-list | grep -1 instance | grep uuid | sed "s/.*\: //g"`; do
238+
echo "Shutting down nova instance $uuid"
239+
xe vm-unpause uuid=$uuid || true
240+
xe vm-shutdown uuid=$uuid
241+
xe vm-destroy uuid=$uuid
242+
done
243+
fi
239244

240245
# Path to head xva. By default keep overwriting the same one to save space
241246
USE_SEPARATE_XVAS=${USE_SEPARATE_XVAS:-0}

tools/xen/build_domU_multi.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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 build_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+
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"
27+
28+
# Wait till the head node is up
29+
while ! curl -L http://$HEAD_PUB_IP | grep -q username; do
30+
echo "Waiting for head node ($HEAD_PUB_IP) to start..."
31+
sleep 5
32+
done
33+
34+
# Build the HA compute host
35+
build_domU $COMPUTE_PUB_IP $COMPUTE_PUB_IP $COMPUTE_MGT_IP 0 "ENABLED_SERVICES=n-cpu,n-net,n-api"

0 commit comments

Comments
 (0)