From 9c9b93b3e622f32530b76b343407e4c50459b546 Mon Sep 17 00:00:00 2001
From: grev <grev>
Date: Tue, 5 Aug 2008 12:03:36 +0000
Subject: [PATCH] b=16487 i=Adilger t-f fix for run the command concurrently on
 local and remote clients

---
 lustre/tests/test-framework.sh | 32 +++++++-------------------------
 1 file changed, 7 insertions(+), 25 deletions(-)

diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh
index b1b5df1b62..f0939d8de8 100644
--- a/lustre/tests/test-framework.sh
+++ b/lustre/tests/test-framework.sh
@@ -379,6 +379,7 @@ zconf_umount() {
     fi
 }
 
+# mount clients if not mouted
 zconf_mount_clients() {
     local OPTIONS
     local clients=$1
@@ -395,8 +396,10 @@ zconf_mount_clients() {
     fi
 
     echo "Starting client $clients: $OPTIONS $device $mnt"
-    do_nodes $clients mkdir -p $mnt
-    do_nodes $clients mount -t lustre $OPTIONS $device $mnt || return 1
+    do_nodes $clients "mount | grep $mnt || { mkdir -p $mnt && mount -t lustre $OPTIONS $device $mnt || false; }"
+
+    echo "Started clients $clients: "
+    do_nodes $clients "mount | grep $mnt"
 
     do_nodes $clients "sysctl -w lnet.debug=$PTLDEBUG;
         sysctl -w lnet.subsystem_debug=${SUBSYSTEM# };
@@ -799,24 +802,13 @@ do_node() {
 }
 
 do_nodes() {
-    local nodes=$1
+    local rnodes=$1
     shift
 
-    nodes=${nodes//,/ }
-    # split list to local and remote
-    local rnodes=$(echo " $nodes " | sed -re "s/\s+$HOSTNAME\s+/ /g")
- 
-    if [ "$(get_node_count $nodes)" != "$(get_node_count $rnodes)" ]; then
-        do_node $HOSTNAME $@
-    fi
-
-    [ -z "$(echo $rnodes)" ] && return 0
-
     # This is part from do_node
     local myPDSH=$PDSH
 
-    rnodes=$(comma_list $rnodes)
-    [ -z "$myPDSH" -o "$myPDSH" = "no_dsh" ] && \
+    [ -z "$myPDSH" -o "$myPDSH" = "no_dsh" -o "$myPDSH" = "rsh" ] && \
         echo "cannot run remote command on $rnodes with $myPDSH" && return 128
 
     if $VERBOSE; then
@@ -824,16 +816,6 @@ do_nodes() {
         $myPDSH $rnodes $LCTL mark "$@" > /dev/null 2>&1 || :
     fi
 
-    if [ "$myPDSH" = "rsh" ]; then
-# we need this because rsh does not return exit code of an executed command
-       local command_status="$TMP/cs"
-       rsh $rnodes ":> $command_status"
-       rsh $rnodes "(PATH=\$PATH:$RLUSTRE/utils:$RLUSTRE/tests:/sbin:/usr/sbin;
-                   cd $RPWD; sh -c \"$@\") || 
-                   echo command failed >$command_status"
-       [ -n "$($myPDSH $rnodes cat $command_status)" ] && return 1 || true
-        return 0
-    fi
     $myPDSH $rnodes "(PATH=\$PATH:$RLUSTRE/utils:$RLUSTRE/tests:/sbin:/usr/sbin; cd $RPWD; sh -c \"$@\")" | sed -re "s/\w+:\s//g"
     return ${PIPESTATUS[0]}
 }
-- 
GitLab