From 9efcf6042c9eddd84f8abd70ca2cdf9d20258264 Mon Sep 17 00:00:00 2001 From: Mate Lakat Date: Wed, 19 Dec 2012 10:23:06 +0000 Subject: [PATCH] xenapi: Enhance devstack progress monitoring Fixes bug 1091299 XenServer - devstack install monitors a log file by tailing it, to see, if the devstack installation is finished. In some cases this script does not detect, that the startup script is finished, and just waiting, causing build failures with timeouts. With this change, the install_os_domU script monitors, if the run.sh script is still running, thus guaranteed to exit as soon as run.sh is done. Change-Id: I24a7a46e93ce26be024096828c7954bc694af2b2 --- tools/xen/install_os_domU.sh | 37 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 25 deletions(-) diff --git a/tools/xen/install_os_domU.sh b/tools/xen/install_os_domU.sh index c78c6f2e94..e270e59b37 100755 --- a/tools/xen/install_os_domU.sh +++ b/tools/xen/install_os_domU.sh @@ -376,35 +376,22 @@ if [ "$WAIT_TILL_LAUNCH" = "1" ] && [ -e ~/.ssh/id_rsa.pub ] && [ "$COPYENV" = sleep 10 done - # output the run.sh.log - ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no stack@$DOMU_IP 'tail -f run.sh.log' & - TAIL_PID=$! - - function kill_tail() { - kill -9 $TAIL_PID - exit 1 - } - # Let Ctrl-c kill tail and exit - trap kill_tail SIGINT - - # ensure we kill off the tail if we exit the script early - # for other reasons - add_on_exit "kill -9 $TAIL_PID || true" - - # wait silently until stack.sh has finished - set +o xtrace - while ! ssh_no_check -q stack@$DOMU_IP "tail run.sh.log | grep -q 'stack.sh completed in'"; do + set +x + echo -n "Waiting for startup script to finish" + while [ `ssh_no_check -q stack@$DOMU_IP pgrep -c run.sh` -ge 1 ] + do sleep 10 + echo -n "." done - set -o xtrace + echo "done!" + set -x - # kill the tail process now stack.sh has finished - kill -9 $TAIL_PID + # output the run.sh.log + ssh_no_check -q stack@$DOMU_IP 'cat run.sh.log' + + # Fail if the expected text is not found + ssh_no_check -q stack@$DOMU_IP 'cat run.sh.log' | grep -q 'stack.sh completed in' - # check for a failure - if ssh_no_check -q stack@$DOMU_IP "grep -q 'stack.sh failed' run.sh.log"; then - exit 1 - fi echo "################################################################################" echo "" echo "All Finished!"