From 7d4849499663a42ed81e1f9ebc95c82fc70dc4c3 Mon Sep 17 00:00:00 2001 From: Atin Mukherjee Date: Fri, 3 Aug 2018 20:50:43 +0530 Subject: tests: kill_brick should wait for brick status to become offline Change-Id: I52e8eec7f334af37de433c444f4ddfc876fa56cc Fixes: bz#1614088 Signed-off-by: Atin Mukherjee --- tests/volume.rc | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'tests/volume.rc') diff --git a/tests/volume.rc b/tests/volume.rc index 7a7a580ec3e..cc0b5c670e4 100644 --- a/tests/volume.rc +++ b/tests/volume.rc @@ -303,16 +303,16 @@ function kill_brick { local socket=$(cat $cmdline | tr '\0' '\n' | grep '\.socket$') gf_attach -d $socket $brick - - # When the last brick in a process is terminated, the process has to - # sleep for a second to give the RPC response a chance to get back to - # GlusterD. Without that, we get random failures in tests that use - # "volume stop" whenever the process termination is observed before the - # RPC response. However, that same one-second sleep can cause other - # random failures in tests that assume a brick will already be gone - # before "gf_attach -d" returns. There are too many of those to fix, - # so we compensate by putting the same one-second sleep here. - sleep 1 + cnt=1 + while [ "$cnt" -le "$PROCESS_UP_TIMEOUT" ] ; + do + online=`$CLI volume status $vol $host:$brick --xml | sed -ne 's/.*\([01]\)<\/status>/\1/p'` + if [ $online -eq 0 ] ; then + break; + fi + cnt=$(( $cnt + 1 )) + sleep 1 + done } function check_option_help_presence { -- cgit