Whamcloud - gitweb
LU-5810 tests: add client hostname to lctl mark 13/13113/4
authorAndreas Dilger <andreas.dilger@intel.com>
Tue, 16 Dec 2014 02:32:37 +0000 (19:32 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 27 May 2016 00:57:38 +0000 (00:57 +0000)
Improve debug messages to include the originating hostname.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Change-Id: I441bf8294c38135276a5a0f0853dbebf4358c563
Reviewed-on: http://review.whamcloud.com/13113
Tested-by: Jenkins
Reviewed-by: Emoly Liu <emoly.liu@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: James Nunez <james.a.nunez@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/tests/lockorder.sh
lustre/tests/recovery-small.sh
lustre/tests/replay-single-lmv.sh
lustre/tests/replay-single.sh
lustre/tests/sanity.sh
lustre/tests/sanityn.sh
lustre/tests/test-framework.sh

index 122df46..c21498d 100644 (file)
@@ -56,7 +56,7 @@ mv $MAXDIR $LOCKDIR
 mv $MINFILE $LOCKFILE
 rm -rf $DIR/d$$
 
 mv $MINFILE $LOCKFILE
 rm -rf $DIR/d$$
 
-$LCTL mark "start dir: $LOCKDIR=$MAXRES file: $LOCKFILE=$MINRES"
+$LCTL mark "$HOSTNAME: start dir: $LOCKDIR=$MAXRES file: $LOCKFILE=$MINRES"
 # link will lock $LOCKFILE and $DIR as it creates ${LOCKFILE}{0,1,...}
 $CREATEMANY -l$LOCKFILE $LOCKFILE -$COUNT &
 CR_PID=$!
 # link will lock $LOCKFILE and $DIR as it creates ${LOCKFILE}{0,1,...}
 $CREATEMANY -l$LOCKFILE $LOCKFILE -$COUNT &
 CR_PID=$!
index 4c81abc..a36eeb1 100755 (executable)
@@ -308,7 +308,7 @@ run_test 11 "wake up a thread waiting for completion after eviction (b=2460)"
 
 #b=2494
 test_12(){
 
 #b=2494
 test_12(){
-       $LCTL mark $MULTIOP $DIR/$tfile OS_c
+       $LCTL mark "$HOSTNAME: $MULTIOP $DIR/$tfile OS_c"
        do_facet $SINGLEMDS "lctl set_param fail_loc=0x115"
        clear_failloc $SINGLEMDS $((TIMEOUT * 2)) &
        multiop_bg_pause $DIR/$tfile OS_c ||
        do_facet $SINGLEMDS "lctl set_param fail_loc=0x115"
        clear_failloc $SINGLEMDS $((TIMEOUT * 2)) &
        multiop_bg_pause $DIR/$tfile OS_c ||
index 21dd7ca..db137fe 100755 (executable)
@@ -94,22 +94,22 @@ test_2a() {
 run_test 2a "unlink cross-node file (fail mds with name)"
 
 test_3a() {
 run_test 2a "unlink cross-node file (fail mds with name)"
 
 test_3a() {
-    replay_barrier mds2
-    mkdir $DIR/dir3a1
-    $LCTL mark "FAILOVER mds2"
-    fail mds2
-    stat $DIR
-    $CHECKSTAT -t dir $DIR/dir3a1 || return 1
+       replay_barrier mds2
+       mkdir $DIR/dir3a1
+       $LCTL mark "$HOSTNAME FAILOVER mds2"
+       fail mds2
+       stat $DIR
+       $CHECKSTAT -t dir $DIR/dir3a1 || return 1
 }
 run_test 3a "mkdir cross-node dir (fail mds with inode)"
 
 test_3b() {
 }
 run_test 3a "mkdir cross-node dir (fail mds with inode)"
 
 test_3b() {
-    replay_barrier mds1
-    mkdir $DIR/dir3b1
-    $LCTL mark "FAILOVER mds1"
-    fail mds1
-    stat $DIR
-    $CHECKSTAT -t dir $DIR/dir3b1 || return 1
+       replay_barrier mds1
+       mkdir $DIR/dir3b1
+       $LCTL mark "$HOSTNAME FAILOVER mds1"
+       fail mds1
+       stat $DIR
+       $CHECKSTAT -t dir $DIR/dir3b1 || return 1
 }
 run_test 3b "mkdir cross-node dir (fail mds with inode)"
 
 }
 run_test 3b "mkdir cross-node dir (fail mds with inode)"
 
index f74f3a3..0df8804 100755 (executable)
@@ -873,7 +873,7 @@ test_40(){
        lctl get_param mdc.*.connect_flags | grep -q layout_lock &&
                skip "layout_lock needs MDS connection for IO" && return 0
 
        lctl get_param mdc.*.connect_flags | grep -q layout_lock &&
                skip "layout_lock needs MDS connection for IO" && return 0
 
-       $LCTL mark multiop $MOUNT/$tfile OS_c
+       $LCTL mark "$HOSTNAME multiop $MOUNT/$tfile OS_c"
        multiop $MOUNT/$tfile OS_c  &
        PID=$!
        writeme -s $MOUNT/${tfile}-2 &
        multiop $MOUNT/$tfile OS_c  &
        PID=$!
        writeme -s $MOUNT/${tfile}-2 &
index 47a58fe..d9199d5 100644 (file)
@@ -5289,14 +5289,14 @@ test_60d() {
 
        # verify "lctl mark" is even working"
        MESSAGE="test message ID $RANDOM $$"
 
        # verify "lctl mark" is even working"
        MESSAGE="test message ID $RANDOM $$"
-       $LCTL mark "$MESSAGE" || error "$LCTL mark failed"
+       $LCTL mark "$HOSTNAME $MESSAGE" || error "$LCTL mark failed"
        dmesg | grep -q "$MESSAGE" || error "didn't find debug marker in log"
 
        lctl set_param printk=0 || error "set lnet.printk failed"
        lctl get_param -n printk | grep emerg || error "lnet.printk dropped emerg"
        MESSAGE="new test message ID $RANDOM $$"
        # Assume here that libcfs_debug_mark_buffer() uses D_WARNING
        dmesg | grep -q "$MESSAGE" || error "didn't find debug marker in log"
 
        lctl set_param printk=0 || error "set lnet.printk failed"
        lctl get_param -n printk | grep emerg || error "lnet.printk dropped emerg"
        MESSAGE="new test message ID $RANDOM $$"
        # Assume here that libcfs_debug_mark_buffer() uses D_WARNING
-       $LCTL mark "$MESSAGE" || error "$LCTL mark failed"
+       $LCTL mark "$HOSTNAME $MESSAGE" || error "$LCTL mark failed"
        dmesg | grep -q "$MESSAGE" && error "D_WARNING wasn't masked" || true
 
        lctl set_param -n printk="$SAVEPRINTK"
        dmesg | grep -q "$MESSAGE" && error "D_WARNING wasn't masked" || true
 
        lctl set_param -n printk="$SAVEPRINTK"
index e96bce8..738c837 100755 (executable)
@@ -1219,7 +1219,7 @@ test_36() { #bug 16417
        sync; sleep 5; sync # wait for delete thread
 
        while [ $i -le 10 ]; do
        sync; sleep 5; sync # wait for delete thread
 
        while [ $i -le 10 ]; do
-               lctl mark "start test"
+               lctl mark "$HOSTNAME start test loop $i"
                local before=$(lfs_df $MOUNT1 | awk '/^filesystem/{ print $4; exit }')
                dd if=/dev/zero of=$DIR1/$tdir/$tfile bs=1M count=$SIZE ||
                        error "dd $DIR1/$tdir/$tfile ${SIZE}MB failed"
                local before=$(lfs_df $MOUNT1 | awk '/^filesystem/{ print $4; exit }')
                dd if=/dev/zero of=$DIR1/$tdir/$tfile bs=1M count=$SIZE ||
                        error "dd $DIR1/$tdir/$tfile ${SIZE}MB failed"
index 098a563..b323882 100755 (executable)
@@ -2547,8 +2547,8 @@ replay_barrier() {
        # inside fail() and fail_abort().
        #
        do_facet $facet $LCTL --device ${!svc} readonly
        # inside fail() and fail_abort().
        #
        do_facet $facet $LCTL --device ${!svc} readonly
-       do_facet $facet $LCTL mark "$facet REPLAY BARRIER on ${!svc}"
-       $LCTL mark "local REPLAY BARRIER on ${!svc}"
+       do_facet $facet $LCTL mark "$HOSTNAME: $facet REPLAY BARRIER on ${!svc}"
+       $LCTL mark "$HOSTNAME: local REPLAY BARRIER on ${!svc}"
 }
 
 replay_barrier_nodf() {
 }
 
 replay_barrier_nodf() {
@@ -2558,8 +2558,8 @@ replay_barrier_nodf() {
        echo Replay barrier on ${!svc}
        do_facet $facet $LCTL --device ${!svc} notransno
        do_facet $facet $LCTL --device ${!svc} readonly
        echo Replay barrier on ${!svc}
        do_facet $facet $LCTL --device ${!svc} notransno
        do_facet $facet $LCTL --device ${!svc} readonly
-       do_facet $facet $LCTL mark "$facet REPLAY BARRIER on ${!svc}"
-       $LCTL mark "local REPLAY BARRIER on ${!svc}"
+       do_facet $facet $LCTL mark "$HOSTNAME: $facet REPLAY BARRIER on ${!svc}"
+       $LCTL mark "$HOSTNAME: local REPLAY BARRIER on ${!svc}"
 }
 
 replay_barrier_nosync() {
 }
 
 replay_barrier_nosync() {
@@ -2568,8 +2568,8 @@ replay_barrier_nosync() {
        echo Replay barrier on ${!svc}
        do_facet $facet $LCTL --device ${!svc} notransno
        do_facet $facet $LCTL --device ${!svc} readonly
        echo Replay barrier on ${!svc}
        do_facet $facet $LCTL --device ${!svc} notransno
        do_facet $facet $LCTL --device ${!svc} readonly
-       do_facet $facet $LCTL mark "$facet REPLAY BARRIER on ${!svc}"
-       $LCTL mark "local REPLAY BARRIER on ${!svc}"
+       do_facet $facet $LCTL mark "$HOSTNAME: $facet REPLAY BARRIER on ${!svc}"
+       $LCTL mark "$HOSTNAME: local REPLAY BARRIER on ${!svc}"
 }
 
 #
 }
 
 #
@@ -2884,26 +2884,26 @@ change_active() {
 }
 
 do_node() {
 }
 
 do_node() {
-    local verbose=false
-    # do not stripe off hostname if verbose, bug 19215
-    if [ x$1 = x--verbose ]; then
-        shift
-        verbose=true
-    fi
+       local verbose=false
+       # do not stripe off hostname if verbose, bug 19215
+       if [ x$1 = x--verbose ]; then
+               shift
+               verbose=true
+       fi
 
 
-    local HOST=$1
-    shift
-    local myPDSH=$PDSH
-    if [ "$HOST" = "$HOSTNAME" ]; then
-        myPDSH="no_dsh"
-    elif [ -z "$myPDSH" -o "$myPDSH" = "no_dsh" ]; then
-        echo "cannot run remote command on $HOST with $myPDSH"
-        return 128
-    fi
-    if $VERBOSE; then
-        echo "CMD: $HOST $@" >&2
-        $myPDSH $HOST "$LCTL mark \"$@\"" > /dev/null 2>&1 || :
-    fi
+       local HOST=$1
+       shift
+       local myPDSH=$PDSH
+       if [ "$HOST" = "$HOSTNAME" ]; then
+               myPDSH="no_dsh"
+       elif [ -z "$myPDSH" -o "$myPDSH" = "no_dsh" ]; then
+               echo "cannot run remote command on $HOST with $myPDSH"
+               return 128
+       fi
+       if $VERBOSE; then
+               echo "CMD: $HOST $@" >&2
+               $myPDSH $HOST "$LCTL mark \"$HOSTNAME: $@\"" &>/dev/null || :
+       fi
 
     if [ "$myPDSH" = "rsh" ]; then
 # we need this because rsh does not return exit code of an executed command
 
     if [ "$myPDSH" = "rsh" ]; then
 # we need this because rsh does not return exit code of an executed command
@@ -2999,17 +2999,18 @@ do_nodes() {
         return $?
     fi
 
         return $?
     fi
 
-    # This is part from do_node
-    local myPDSH=$PDSH
+       # This is part from do_node
+       local myPDSH=$PDSH
 
 
-    [ -z "$myPDSH" -o "$myPDSH" = "no_dsh" -o "$myPDSH" = "rsh" ] && \
-        echo "cannot run remote command on $rnodes with $myPDSH" && return 128
+       [ -z "$myPDSH" -o "$myPDSH" = "no_dsh" -o "$myPDSH" = "rsh" ] &&
+               echo "cannot run remote command on $rnodes with $myPDSH" &&
+               return 128
 
 
-    export FANOUT=$(get_node_count "${rnodes//,/ }")
-    if $VERBOSE; then
-        echo "CMD: $rnodes $@" >&2
-        $myPDSH $rnodes "$LCTL mark \"$@\"" > /dev/null 2>&1 || :
-    fi
+       export FANOUT=$(get_node_count "${rnodes//,/ }")
+       if $VERBOSE; then
+               echo "CMD: $rnodes $@" >&2
+               $myPDSH $rnodes "$LCTL mark \"$HOSTNAME: $@\"" &>/dev/null || :
+       fi
 
     # do not replace anything from pdsh output if -N is used
     # -N     Disable hostname: prefix on lines of output.
 
     # do not replace anything from pdsh output if -N is used
     # -N     Disable hostname: prefix on lines of output.
@@ -4624,10 +4625,10 @@ set_nodes_failloc () {
 }
 
 cancel_lru_locks() {
 }
 
 cancel_lru_locks() {
-       #$LCTL mark "cancel_lru_locks $1 start"
+       #$LCTL mark "$HOSTNAME: cancel_lru_locks $1 start"
        $LCTL set_param -n ldlm.namespaces.*$1*.lru_size=clear
        $LCTL get_param ldlm.namespaces.*$1*.lock_unused_count | grep -v '=0'
        $LCTL set_param -n ldlm.namespaces.*$1*.lru_size=clear
        $LCTL get_param ldlm.namespaces.*$1*.lock_unused_count | grep -v '=0'
-       #$LCTL mark "cancel_lru_locks $1 stop"
+       #$LCTL mark "$HOSTNAME: cancel_lru_locks $1 stop"
 }
 
 default_lru_size()
 }
 
 default_lru_size()
@@ -4925,17 +4926,18 @@ log() {
        echo "$*" >&2
        load_module ../libcfs/libcfs/libcfs
 
        echo "$*" >&2
        load_module ../libcfs/libcfs/libcfs
 
-    local MSG="$*"
-    # Get rid of '
-    MSG=${MSG//\'/\\\'}
-    MSG=${MSG//\(/\\\(}
-    MSG=${MSG//\)/\\\)}
-    MSG=${MSG//\;/\\\;}
-    MSG=${MSG//\|/\\\|}
-    MSG=${MSG//\>/\\\>}
-    MSG=${MSG//\</\\\<}
-    MSG=${MSG//\//\\\/}
-    do_nodes $(comma_list $(nodes_list)) $LCTL mark "$MSG" 2> /dev/null || true
+       local MSG="$HOSTNAME: $*"
+       # Get rid of '
+       MSG=${MSG//\'/\\\'}
+       MSG=${MSG//\(/\\\(}
+       MSG=${MSG//\)/\\\)}
+       MSG=${MSG//\;/\\\;}
+       MSG=${MSG//\|/\\\|}
+       MSG=${MSG//\>/\\\>}
+       MSG=${MSG//\</\\\<}
+       MSG=${MSG//\//\\\/}
+       do_nodes $(comma_list $(nodes_list)) $LCTL mark "$MSG" 2> /dev/null ||
+               true
 }
 
 trace() {
 }
 
 trace() {