Whamcloud - gitweb
LU-372 add $TMP/mgsactive to indicate the active combined MGS/MDS node
authorYu Jian <yujian@whamcloud.com>
Fri, 27 May 2011 04:17:12 +0000 (12:17 +0800)
committerJohann Lombardi <johann@whamcloud.com>
Tue, 7 Jun 2011 14:36:55 +0000 (07:36 -0700)
The current test-framework could not figure out the active MGS node
correctly while the MGS and MDS nodes are combined under a failover
configuration. We need add a $TMP/mgsactive file to indicate the
active MGS node like what we did for the MDS node.

In addition, "set_default_debug_nodes()" has a defect to check
whether "$nodes" contains the local node or not. The patch contains
a fix for that.

Signed-off-by: Yu Jian <yujian@whamcloud.com>
Change-Id: Iae49497601d09fef38968360d8543cc753009e85
Reviewed-on: http://review.whamcloud.com/871
Tested-by: Hudson
Reviewed-by: Brian J. Murrell <brian@whamcloud.com>
Reviewed-by: Chris Gearing <chris@whamcloud.com>
Reviewed-by: Johann Lombardi <johann@whamcloud.com>
lustre/tests/recovery-small.sh
lustre/tests/test-framework.sh

index e3558c1..0ad3f8e 100755 (executable)
@@ -673,7 +673,9 @@ wait_client_evicted () {
        local exports=$2
        local varsvc=${facet}_svc
 
-       wait_update $(facet_host $facet) "lctl get_param -n *.${!varsvc}.num_exports | cut -d' ' -f2" $((exports - 1)) $3
+       wait_update $(facet_active_host $facet) \
+               "lctl get_param -n *.${!varsvc}.num_exports | cut -d' ' -f2" \
+               $((exports - 1)) $3
 }
 
 test_26a() {      # was test_26 bug 5921 - evict dead exports by pinger
index ecd283e..ab4d286 100644 (file)
@@ -425,20 +425,16 @@ set_default_debug () {
     sync
 }
 
-remote_node () {
-    local node=$1
-    [ "$node" != "$(hostname)" ]
-}
-
 set_default_debug_nodes () {
     local nodes=$1
 
-    if remote_node $nodes; then
-       do_rpc_nodes $nodes set_default_debug \
-            \\\"$PTLDEBUG\\\" \\\"$SUBSYSTEM\\\" $DEBUG_SIZE
-    else
+    if [[ ,$nodes, = *,$HOSTNAME,* ]]; then
+       nodes=$(exclude_items_from_list "$nodes" "$HOSTNAME")
        set_default_debug
     fi
+
+    [[ -n $nodes ]] && do_rpc_nodes $nodes set_default_debug \
+            \\\"$PTLDEBUG\\\" \\\"$SUBSYSTEM\\\" $DEBUG_SIZE || true
 }
 
 set_default_debug_facet () {
@@ -1562,6 +1558,8 @@ change_active() {
     # save the active host for this facet
     local activevar=${facet}active
     echo "$activevar=${!activevar}" > $TMP/$activevar
+    [[ $facet = mds ]] && combined_mgs_mds && \
+        echo "mgsactive=${!activevar}" > $TMP/mgsactive
     local TO=`facet_active_host $facet`
     echo "Failover $facet to $TO"
     done
@@ -1680,6 +1678,7 @@ add() {
     # make sure its not already running
     stop ${facet} -f
     rm -f $TMP/${facet}active
+    [[ $facet = mds ]] && combined_mgs_mds && rm -f $TMP/mgsactive
     do_facet ${facet} $MKFS $*
 }
 
@@ -1725,6 +1724,7 @@ stopall() {
     # currently we use do_facet mds in local.sh
     stop mds -f
     rm -f ${TMP}/mdsactive
+    combined_mgs_mds && rm -f $TMP/mgsactive
     for num in `seq $OSTCOUNT`; do
         stop ost$num -f
         rm -f $TMP/ost${num}active
@@ -2930,6 +2930,11 @@ ostuuid_from_index()
     $LFS osts $2 | awk '/^'$1'/ { print $2 }'
 }
 
+remote_node () {
+    local node=$1
+    [[ $node != $HOSTNAME ]]
+}
+
 remote_mds ()
 {
     remote_node $mds_HOST