From 71a4ec78fb23a2ffc336d7462395361684a635ee Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Tue, 10 Mar 2015 09:50:07 -0600 Subject: [PATCH] Add automatic retry to devstack install script I don't know about anyone else, but whenever I kick off the ds-build role on a fresh VM, I see a high rate of failure with git clone operations ("git call failed" is the error), which kills off stack.sh and results in a failed build. This happens about 50% of the time for me, so I modified the devstack build script to automatically retry if it encounters this error. Change-Id: If91577707ed76b1ec566af9189e30bbdcd81c37d --- ds-build/roles/devstack-build/files/autostack.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ds-build/roles/devstack-build/files/autostack.sh b/ds-build/roles/devstack-build/files/autostack.sh index d56c0e0..b7ea865 100755 --- a/ds-build/roles/devstack-build/files/autostack.sh +++ b/ds-build/roles/devstack-build/files/autostack.sh @@ -39,9 +39,18 @@ su $unpriv_user -c $basedir/devstack/stack.sh 2>&1 & # Wait for stack.sh to complete by watching the log file for $donestring donestring='This is your host ip' +# Sometimes, 'git clone' fails, and this can be retried +retrystring='git call failed: \[git clone' -while [ `tail -1 $log 2>/dev/null |grep -c "$donestring"` = 0 ]; do - sleep 5 +success=0 +while [ "$success" = 0 ]; do + if [ `tail -1 $log 2>/dev/null |grep -c "$donestring"` = 1 ]; then + success=1 + elif [ `tail -2 $log 2>/dev/null |grep -c "$retrystring"` = 1 ]; then + pkill -f devstack/stack.sh + su $unpriv_user -c $basedir/devstack/stack.sh 2>&1 & + fi + sleep 10 done # Kill off the now-idle stack.sh process