diff --git a/tools/xen/build_xva.sh b/tools/xen/build_xva.sh index d0cdf17391..7272fe2664 100755 --- a/tools/xen/build_xva.sh +++ b/tools/xen/build_xva.sh @@ -93,13 +93,34 @@ mkdir -p $STAGING_DIR/opt/stack/devstack tar xf /tmp/devstack.tar -C $STAGING_DIR/opt/stack/devstack cd $TOP_DIR -# Run devstack on launch -cat <$STAGING_DIR/etc/rc.local -# network restart required for getting the right gateway -/etc/init.d/networking restart -chown -R $STACK_USER /opt/stack -su -c "/opt/stack/run.sh > /opt/stack/run.sh.log" $STACK_USER -exit 0 +# Create an upstart job (task) for devstack, which can interact with the console +cat >$STAGING_DIR/etc/init/devstack.conf << EOF +start on stopped rc RUNLEVEL=[2345] + +console output +task + +pre-start script + rm -f /var/run/devstack.succeeded +end script + +script + initctl stop hvc0 || true + + # Read any leftover characters from standard input + while read -n 1 -s -t 0.1 -r ignored; do + true + done + + clear + + chown -R $STACK_USER /opt/stack + + if su -c "/opt/stack/run.sh" $STACK_USER; then + touch /var/run/devstack.succeeded + fi + initctl start hvc0 > /dev/null 2>&1 +end script EOF # Configure the hostname @@ -138,8 +159,9 @@ fi # Configure run.sh cat <$STAGING_DIR/opt/stack/run.sh #!/bin/bash +set -eux cd /opt/stack/devstack -killall screen -VIRT_DRIVER=xenserver FORCE=yes MULTI_HOST=$MULTI_HOST HOST_IP_IFACE=$HOST_IP_IFACE $STACKSH_PARAMS ./stack.sh +./unstack.sh || true +./stack.sh EOF chmod 755 $STAGING_DIR/opt/stack/run.sh diff --git a/tools/xen/install_os_domU.sh b/tools/xen/install_os_domU.sh index 6ce334bc00..41b184c6ac 100755 --- a/tools/xen/install_os_domU.sh +++ b/tools/xen/install_os_domU.sh @@ -367,25 +367,20 @@ COPYENV=${COPYENV:-1} if [ "$WAIT_TILL_LAUNCH" = "1" ] && [ -e ~/.ssh/id_rsa.pub ] && [ "$COPYENV" = "1" ]; then set +x - echo "VM Launched - Waiting for startup script" - # wait for log to appear - while ! ssh_no_check -q stack@$OS_VM_MANAGEMENT_ADDRESS "[ -e run.sh.log ]"; do + echo "VM Launched - Waiting for devstack to start" + while ! ssh_no_check -q stack@$OS_VM_MANAGEMENT_ADDRESS "service devstack status | grep -q running"; do sleep 10 done - echo -n "Running" - while [ `ssh_no_check -q stack@$OS_VM_MANAGEMENT_ADDRESS pgrep -c run.sh` -ge 1 ] - do + echo -n "devstack is running" + while ssh_no_check -q stack@$OS_VM_MANAGEMENT_ADDRESS "service devstack status | grep -q running"; do sleep 10 echo -n "." done echo "done!" set -x - # output the run.sh.log - ssh_no_check -q stack@$OS_VM_MANAGEMENT_ADDRESS 'cat run.sh.log' - - # Fail if the expected text is not found - ssh_no_check -q stack@$OS_VM_MANAGEMENT_ADDRESS 'cat run.sh.log' | grep -q 'stack.sh completed in' + # Fail if devstack did not succeed + ssh_no_check -q stack@$OS_VM_MANAGEMENT_ADDRESS 'test -e /var/run/devstack.succeeded' set +x echo "################################################################################" @@ -399,11 +394,12 @@ else 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 "looking at the console of your domU / checking the log files." echo "" echo "ssh into your domU now: 'ssh stack@$OS_VM_MANAGEMENT_ADDRESS' using your password" - echo "and then do: 'tail -f /opt/stack/run.sh.log'" + echo "and then do: 'sudo service devstack status' to check if devstack is still running." + echo "Check that /var/run/devstack.succeeded exists" echo "" - echo "When the script completes, you can then visit the OpenStack Dashboard" + echo "When devstack completes, you can visit the OpenStack Dashboard" echo "at http://$OS_VM_SERVICES_ADDRESS, and contact other services at the usual ports." fi