From 43d19e90c719402a8d73e559ce4368aa55a4f16b Mon Sep 17 00:00:00 2001 From: Jian Yu Date: Tue, 2 Dec 2014 18:26:10 -0800 Subject: [PATCH] LU-5857 tests: check lctl return value in check_catastrophe() This patch fixes check_catastrophe() to check the return value of lctl command. The catastrophe value would be checked only if the lctl command passed. The patch also simplifies the function to check catastrophe value on all of the test nodes without separating local and remote nodes. Signed-off-by: Jian Yu Change-Id: I0ffdafe27b0829dde5a8ea136be76e35b5ea8f43 Reviewed-on: http://review.whamcloud.com/12640 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Bob Glossman Reviewed-by: Oleg Drokin --- lustre/tests/test-framework.sh | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index 07784ff..18ebafa 100755 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -5641,26 +5641,15 @@ restore_lustre_params() { } check_catastrophe() { - local rnodes=${1:-$(comma_list $(remote_nodes_list))} - VAR=$(lctl get_param -n catastrophe 2>&1) - if [ $? = 0 ] ; then - if [ $VAR != 0 ]; then - return 1 - fi - fi - - [ -z "$rnodes" ] && return 0 + local nodes=${1:-$(comma_list $(nodes_list))} - local data - data=$(do_nodes "$rnodes" "rc=\\\$(lctl get_param -n catastrophe); - if [ \\\$rc -ne 0 ]; then echo \\\$(hostname): \\\$rc; fi - exit \\\$rc") - local rc=$? - if [ -n "$data" ]; then - echo $data - return $rc - fi - return 0 + do_nodes $nodes "rc=0; +val=\\\$($LCTL get_param -n catastrophe 2>&1); +if [[ \\\$? -eq 0 && \\\$val -ne 0 ]]; then + echo \\\$(hostname -s): \\\$val; + rc=\\\$val; +fi; +exit \\\$rc" } # CMD: determine mds index where directory inode presents -- 1.8.3.1