Whamcloud - gitweb
LU-5857 tests: check lctl return value in check_catastrophe() 40/12640/4
authorJian Yu <jian.yu@intel.com>
Wed, 3 Dec 2014 02:26:10 +0000 (18:26 -0800)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 4 Dec 2014 13:36:21 +0000 (13:36 +0000)
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 <jian.yu@intel.com>
Change-Id: I0ffdafe27b0829dde5a8ea136be76e35b5ea8f43
Reviewed-on: http://review.whamcloud.com/12640
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/tests/test-framework.sh

index 07784ff..18ebafa 100755 (executable)
@@ -5641,26 +5641,15 @@ restore_lustre_params() {
 }
 
 check_catastrophe() {
 }
 
 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
 }
 
 # CMD: determine mds index where directory inode presents