Whamcloud - gitweb
b:11171
authorjitendra <jitendra>
Wed, 22 Aug 2007 10:38:29 +0000 (10:38 +0000)
committerjitendra <jitendra>
Wed, 22 Aug 2007 10:38:29 +0000 (10:38 +0000)
i:nathan@clusterfs.com
Added automatic ondecho module load support on client and server.
Added flexible OSS setup and cleanup

lustre-iokit/ChangeLog
lustre-iokit/obdfilter-survey/libecho
lustre-iokit/obdfilter-survey/obdfilter-survey

index 6d49615..1b77092 100644 (file)
@@ -11,3 +11,7 @@
 2007-08-01 Jitendra Pawar <jitendra@clusterfs.com>
        Fixes for bug: 10961
        - Modified README.obdfilter-survey
+2007-08-22 Jitendra Pawar <jitendra@clusterfs.com>
+       Aditions for bug: 11171
+       - Added automatic ondecho module load support on client and server
+       - Added flexible OSS setup and cleanup
index 4815445..9bca4b8 100644 (file)
@@ -57,22 +57,6 @@ dsh () {
            ;;
     esac
 }
-# This function executes the command sent through parameters to host
-# parameters
-# 1. hostname
-# 2. command to be executed on host
-custom_remote_shell () {
-    host=$1
-    shift
-    cmds="$*"
-    here=`pwd`
-    # Hop on to the remote node, chdir to 'here' and run the given
-    # commands. One of the following will probably work.
-    ssh $host "cd $here; $cmds"
-    #rsh $host "cd $here; $cmds"
-    # we have to remove the leading `uname -n`: from pdsh output lines
-    #pdsh -w $host "cd $here; $cmds" | sed 's/^[^:]*://'
-}
 
 # how to run commands on other nodes
 # You need to make this work on your cluster if you have specified
@@ -173,6 +157,7 @@ get_devnos () {
 
 # do cleanup and exit.
 cleanup () {
+    local clean_srv_OSS=$2
     for ((i = 0; i < ndevs; i++)); do
        host=${host_names[$i]}
            if [ -n ${do_teardown_ec[$i]} ]; then
@@ -181,7 +166,7 @@ cleanup () {
     done
     pidcount=0
     for host in ${unique_hosts[@]}; do
-        remote_shell $host "killall vmstat -q" &
+        remote_shell $host "killall -q vmstat >/dev/null 2>&1" &
         pid=$!
         kill -term ${vmstatpids[$pidcount]} 2>/dev/null
         kill -kill ${vmstatpids[$pidcount]} 2>/dev/null
@@ -193,23 +178,31 @@ cleanup () {
     done
     if [ $case == "network" ]; then
         lctl <<EOF
-        device osc_testfs
+        cfg_device osc_testfs
         cleanup
         detach
 EOF
         remote_shell "root@$server_nid" "lctl << EOF
-            device OSS
+            cfg_device echo_srv
             cleanup
             detach
-            device ost_testfs
+EOF"
+    fi
+    if [ $clean_srv_OSS ]; then
+        remote_shell "root@$server_nid" "lctl << EOF
+            cfg_device OSS
             cleanup
             detach
 EOF"
     fi
-    if [ $1 -ne 0 ]; then 
-       echo "program exited with error "
+    if [ $1 ]; then
+        if [ $1 -ne 0 ]; then
+            echo "program exited with error "
+        else
+            echo "done!"
+        fi
     else
-       echo "done!"
+        echo "Terminated"
     fi
     exit $1
 }
@@ -275,11 +268,11 @@ ec_using_srv_nid () {
     local server_nid=$1
     local ocsname=$2
     local oscuuid=$3
+    $lctl add_uuid testfs_UUID $server_nid@tcp >/dev/null 2>&1
     $lctl <<EOF
-        add_uuid testfs_UUID $server_nid@tcp
         attach osc $ocsname $oscuuid
         cfg_device $ocsname
-        setup ost_testfs_UUID testfs_UUID
+        setup echo_srv_UUID testfs_UUID
 EOF
     $lctl <<EOF
         attach echo_client ECHO_$ocsname $oscuuid
@@ -287,19 +280,25 @@ EOF
 EOF
 }
 
-# setup obdecho and ost on server
+# setup obdecho on server
 setup_srv_obd () {
     local server_nid=$1
     local test_ostfsnm=$2
-    echo 
     remote_shell "root@$server_nid" "$lctl << EOF
-               attach obdecho $test_ostfsnm ${test_ostfsnm}_UUID
+        attach obdecho $test_ostfsnm ${test_ostfsnm}_UUID
         cfg_device $test_ostfsnm
         setup
+EOF"
+}
+
+# setup OSS on server
+setup_OSS () {
+    local server_nid=$1
+    remote_shell "root@$server_nid" "$lctl << EOF
         attach ost OSS OSS_UUID
         cfg_device OSS
         setup
-EOF"  
+EOF"
 }
 
 # cleanup and detach the echo-clients that we have created during the test.
index 77f2cb3..fd8407d 100755 (executable)
@@ -240,6 +240,10 @@ snap=1
 #####################################################################
 # leave the rest of this alone unless you know what you're doing...
 
+# check and insert obdecho module
+if ! lsmod | grep obdecho > /dev/null; then
+    modprobe obdecho
+fi
 if [ ${#tests[@]} -eq 0 -o "${tests[0]}" != "write" ]; then
     echo "tests: ${tests[@]}"
     echo "First test must be 'write'" 1>&2
@@ -269,34 +273,24 @@ if [ $case == "network" ]; then
        echo "Specify the server NID"
        exit 1;
     fi
-    osc_names_string=`dsh $server_nid root "lctl dl"`
-    count=0;
-    for name in $osc_names_str; do
-        count=$((count+1))
-    done
-
-    if [ $count != 0 ]; then
-        echo "The existing setup must be cleaned";
-        exit 0;
+    # check for obdecho module on server
+    if ! dsh $server_nid root "lsmod | grep obdecho > /dev/null"; then
+        dsh $server_nid root "modprobe obdecho"
     fi
     # Now do the server setup
-    setup_srv_obd $server_nid "ost_testfs"
-    op_string=`dsh $server_nid root "lctl dl"`
-    
-    obdecho=0
-    ost=0 
-    for name in $op_string; do
-       if [ "$name" = "obdecho" ]; then
-           obdecho=1
-       fi
-       if [ "$name" = "ost" ]; then
-           ost=1
-       fi
-    done
-
-    if (( $obdecho == 0 || $ost == 0 )); then
-       echo "Server setup not done properly"
-       exit 1
+    setup_srv_obd $server_nid "echo_srv"
+    oss_on_srv=`dsh $server_nid root "lctl dl | grep OSS | awk '{ print $4 }'"`
+    if [ ! $oss_on_srv ]; then
+        setup_OSS $server_nid
+        clean_srv_OSS=1
+    fi
+    if ! dsh $server_nid root "lctl dl | grep obdecho > /dev/null 2>&1"; then
+        echo "obdecho not setup on server"
+        exit 1
+    fi
+    if ! dsh $server_nid root "lctl dl | grep ost > /dev/null 2>&1"; then
+        echo "ost not setup on server"
+        exit 1
     fi
     # Now start client setup
     osc_names_str=$(lctl dl)
@@ -404,6 +398,7 @@ for ((i=0; i < ndevs; i++)); do
     client_names[$i]=${devno[1]}
     do_teardown_ec[$i]=${devno[2]}
 done
+print_summary "$(date) Obdfilter-survey for case=$case from $(hostname)"
 for ((rsz = $rszlo; rsz <= $rszhi; rsz*=2)); do
     for ((nobj = $nobjlo; nobj <= $nobjhi; nobj*=2)); do 
        for ((thr = $thrlo; thr <= $thrhi; thr*=2)); do
@@ -550,6 +545,5 @@ for ((rsz = $rszlo; rsz <= $rszhi; rsz*=2)); do
        done
     done
 done
-
-cleanup 0
+cleanup 0 $clean_srv_OSS
 exit 0