summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAtin Mukherjee <amukherj@redhat.com>2018-08-03 20:50:43 +0530
committerAtin Mukherjee <amukherj@redhat.com>2018-08-10 02:03:14 +0000
commit7d4849499663a42ed81e1f9ebc95c82fc70dc4c3 (patch)
treef312de31e46cedaaf15c08baba33276d361c33c3
parent69c557ad8468f9e32090cbef78512f82a98f7043 (diff)
tests: kill_brick should wait for brick status to become offline
Change-Id: I52e8eec7f334af37de433c444f4ddfc876fa56cc Fixes: bz#1614088 Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
-rw-r--r--tests/volume.rc20
1 files changed, 10 insertions, 10 deletions
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/.*<status>\([01]\)<\/status>/\1/p'`
+ if [ $online -eq 0 ] ; then
+ break;
+ fi
+ cnt=$(( $cnt + 1 ))
+ sleep 1
+ done
}
function check_option_help_presence {