From dc408266e961fc415c880e7f702192488a1eda95 Mon Sep 17 00:00:00 2001 From: Vladimir Popov Date: Thu, 11 Mar 2021 19:09:18 +0700 Subject: [PATCH] Enhance waiting for the node restart Signed-off-by: Vladimir Popov --- scripts/sriov/setup-SRIOV.sh | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/scripts/sriov/setup-SRIOV.sh b/scripts/sriov/setup-SRIOV.sh index b2dd83bb..5dc39f3f 100755 --- a/scripts/sriov/setup-SRIOV.sh +++ b/scripts/sriov/setup-SRIOV.sh @@ -39,17 +39,26 @@ wait_pids "${pids}" "SR-IOV setup failed" || exit 3 sleep 5 -i=0 for ip in ${master_ip} ${worker_ip}; do - ssh ${SSH_OPTS} root@${ip} -o ConnectTimeout=1 true - while test $? -ne 0; do - ((i++)) - # ~15 minutes to start - if test $i -gt 300; then - echo "timeout waiting for the ${ip} to start, aborting..." && exit 4 + success_attempts=0 + # ~20 minutes to start + for i in {1..400}; do + if [[ ${i} == 400 ]]; then + echo "timeout waiting for the ${ip} to start, aborting..." + exit 4 fi + + if ssh ${SSH_OPTS} root@${ip} -o ConnectTimeout=1 true; then + ((success_attempts++)) + else + success_attempts=0 + fi + + if [[ ${success_attempts} == 3 ]]; then + break + fi + sleep 5 - ssh ${SSH_OPTS} root@${ip} -o ConnectTimeout=1 true done done