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>
}
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