Browse code

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

Mate Lakat authored on 2012/12/19 19:23:06
Showing 1 changed files
... ...
@@ -376,35 +376,22 @@ if [ "$WAIT_TILL_LAUNCH" = "1" ]  && [ -e ~/.ssh/id_rsa.pub  ] && [ "$COPYENV" =
376 376
         sleep 10
377 377
     done
378 378
 
379
-    # output the run.sh.log
380
-    ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no stack@$DOMU_IP 'tail -f run.sh.log' &
381
-    TAIL_PID=$!
382
-
383
-    function kill_tail() {
384
-        kill -9 $TAIL_PID
385
-        exit 1
386
-    }
387
-    # Let Ctrl-c kill tail and exit
388
-    trap kill_tail SIGINT
389
-
390
-    # ensure we kill off the tail if we exit the script early
391
-    # for other reasons
392
-    add_on_exit "kill -9 $TAIL_PID || true"
393
-
394
-    # wait silently until stack.sh has finished
395
-    set +o xtrace
396
-    while ! ssh_no_check -q stack@$DOMU_IP "tail run.sh.log | grep -q 'stack.sh completed in'"; do
379
+    set +x
380
+    echo -n "Waiting for startup script to finish"
381
+    while [ `ssh_no_check -q stack@$DOMU_IP pgrep -c run.sh` -ge 1 ]
382
+    do
397 383
         sleep 10
384
+        echo -n "."
398 385
     done
399
-    set -o xtrace
386
+    echo "done!"
387
+    set -x
400 388
 
401
-    # kill the tail process now stack.sh has finished
402
-    kill -9 $TAIL_PID
389
+    # output the run.sh.log
390
+    ssh_no_check -q stack@$DOMU_IP 'cat run.sh.log'
391
+
392
+    # Fail if the expected text is not found
393
+    ssh_no_check -q stack@$DOMU_IP 'cat run.sh.log' | grep -q 'stack.sh completed in'
403 394
 
404
-    # check for a failure
405
-    if ssh_no_check -q stack@$DOMU_IP "grep -q 'stack.sh failed' run.sh.log"; then
406
-        exit 1
407
-    fi
408 395
     echo "################################################################################"
409 396
     echo ""
410 397
     echo "All Finished!"