From 1de18c62508c05ecf79642b083046c114887f37e Mon Sep 17 00:00:00 2001 From: Anthony Young Date: Tue, 1 Nov 2011 14:19:18 -0500 Subject: [PATCH] Changes to make exercise.sh work with xen --- exercise.sh | 13 +++++--- tools/xen/README.md | 6 ++++ tools/xen/build_domU.sh | 71 ++++++++++++++++++++++++++++++++++------- 3 files changed, 74 insertions(+), 16 deletions(-) diff --git a/exercise.sh b/exercise.sh index ce69a93..99b0f3b 100755 --- a/exercise.sh +++ b/exercise.sh @@ -164,11 +164,14 @@ ping -c1 -w1 $IP # dis-allow icmp traffic (ping) nova secgroup-delete-rule $SECGROUP icmp -1 -1 0.0.0.0/0 -# test we can aren't able to ping our floating ip within ASSOCIATE_TIMEOUT seconds -if ! timeout $ASSOCIATE_TIMEOUT sh -c "while ping -c1 -w1 $FLOATING_IP; do sleep 1; done"; then - print "Security group failure - ping should not be allowed!" - echo "Couldn't ping server with floating ip" - exit 1 +# FIXME (anthony): make xs support security groups +if [ "$VIRT_DRIVER" != "xenserver"]; then + # test we can aren't able to ping our floating ip within ASSOCIATE_TIMEOUT seconds + if ! timeout $ASSOCIATE_TIMEOUT sh -c "while ping -c1 -w1 $FLOATING_IP; do sleep 1; done"; then + print "Security group failure - ping should not be allowed!" + echo "Couldn't ping server with floating ip" + exit 1 + fi fi # de-allocate the floating ip diff --git a/tools/xen/README.md b/tools/xen/README.md index d918c16..63350ea 100644 --- a/tools/xen/README.md +++ b/tools/xen/README.md @@ -46,6 +46,12 @@ Of course, use real passwords if this machine is exposed. XENAPI_PASSWORD=my_super_secret # Do not download the usual images yet! IMAGE_URLS="" + # Explicitly set virt driver here + VIRT_DRIVER=xenserver + # Explicitly set multi-host + MULTI_HOST=1 + # Give extra time for boot + ACTIVE_TIMEOUT=45 EOF Step 4: Run ./build_domU.sh diff --git a/tools/xen/build_domU.sh b/tools/xen/build_domU.sh index 3e4a767..7ca6155 100755 --- a/tools/xen/build_domU.sh +++ b/tools/xen/build_domU.sh @@ -298,14 +298,63 @@ fi # Start guest $TOP_DIR/scripts/install-os-vpx.sh -f $XVA -v $VM_BR -m $MGT_BR -p $PUB_BR -echo "################################################################################" -echo "" -echo "All Finished!" -echo "Now, you can monitor the progress of the stack.sh installation by " -echo "tailing /opt/stack/run.sh.log from within your domU." -echo "" -echo "ssh into your domU now: 'ssh stack@$PUB_IP' using your password" -echo "and then do: 'tail -f /opt/stack/run.sh.log'" -echo "" -echo "When the script completes, you can then visit the OpenStack Dashboard" -echo "at http://$PUB_IP, and contact other services at the usual ports." +# If we have copied our ssh credentials, use ssh to monitor while the installation runs +WAIT_TILL_LAUNCH=${WAIT_TILL_LAUNCH:-1} +if [ "$WAIT_TILL_LAUNCH" = "1" ] && [ -e ~/.ssh/id_rsa.pub ] && [ "$COPYENV" = "1" ]; then + # Done creating the container, let's tail the log + echo + echo "=============================================================" + echo " -- YAY! --" + echo "=============================================================" + echo + echo "We're done launching the vm, about to start tailing the" + echo "stack.sh log. It will take a second or two to start." + echo + echo "Just CTRL-C at any time to stop tailing." + + set +o xtrace + + while ! ssh -q stack@$PUB_IP "[ -e run.sh.log ]"; do + sleep 1 + done + + ssh stack@$PUB_IP 'tail -f run.sh.log' & + + TAIL_PID=$! + + function kill_tail() { + kill $TAIL_PID + exit 1 + } + + # Let Ctrl-c kill tail and exit + trap kill_tail SIGINT + + echo "Waiting stack.sh to finish..." + while ! ssh -q stack@$PUB_IP "grep -q 'stack.sh completed in' run.sh.log" ; do + sleep 1 + done + + kill $TAIL_PID + + if ! ssh -q stack@$PUB_IP "grep -q 'stack.sh failed' run.sh.log" ; then + exit 1 + fi + echo "" + echo "Finished - Zip-a-dee Doo-dah!" + echo "You can then visit the OpenStack Dashboard" + echo "at http://$PUB_IP, and contact other services at the usual ports." +else + echo "################################################################################" + echo "" + echo "All Finished!" + echo "Now, you can monitor the progress of the stack.sh installation by " + echo "tailing /opt/stack/run.sh.log from within your domU." + echo "" + echo "ssh into your domU now: 'ssh stack@$PUB_IP' using your password" + echo "and then do: 'tail -f /opt/stack/run.sh.log'" + echo "" + echo "When the script completes, you can then visit the OpenStack Dashboard" + echo "at http://$PUB_IP, and contact other services at the usual ports." + +fi