Whamcloud - gitweb
b=23531 fix wrong variable use cases in "lustre_acl_xattr_merge2ext()"
[fs/lustre-release.git] / lustre-iokit / obdfilter-survey / obdfilter-survey
index 7b83a8e..ef1871e 100755 (executable)
@@ -268,33 +268,47 @@ for trgt in $targets; do
     client_names[$ndevs]=${str[1]}
     ndevs=$((ndevs+1))
 done
-if [ $case == "netdisk" ]; then
-    if [ "$targets" ]; then
+if [ $case == "disk" ]; then
         for ((i = 0; i < $ndevs; i++)); do
-             setup_osc_for_remote_ost ${host_names[$i]} ${client_names[$i]} $i
-            cleanup_oscs="$cleanup_oscs ${client_names[$i]}_osc"
-            host_names[$i]=localhost
-        done
-    fi
-        declare -a osc_names
-        declare -a osc_uuids
-        osc_names_str=$(lctl dl |grep osc | awk "{if (\$2 == \"UP\" && \$3 == \"osc\") {print \$4} }")
-        count=0;
-        for name in $osc_names_str; do
-            osc_names[$count]=$name
-            count=$((count+1))
-        done
-        osc_uuid_str=$(lctl dl |grep osc | awk "{if (\$2 == \"UP\" && \$3 == \"osc\") {print \$5} }")
-        count=0;
-        for uuid in $osc_uuid_str; do
-            osc_uuids[$count]=$uuid
-            count=$((count+1))
-        done
-        for (( i = 0; i < $count; i++ ))
-        do
-            ec_using_osc ${osc_names[$i]}
-        done
-        echo_clients=$(lctl dl | grep echo_client | awk "{if (\$2 == \"UP\" && \$3 == \"echo_client\") {print \$4} }")
+            ost_names[$i]=${client_names[$i]}
+       done
+fi
+if [ $case == "netdisk" ]; then
+        if [ "$targets" ]; then
+            for ((i = 0; i < $ndevs; i++)); do
+                setup_osc_for_remote_ost ${host_names[$i]} \
+                                         ${client_names[$i]} $i
+                osc_name=${client_names[$i]}_osc
+                ec_using_osc $osc_name
+               cleanup_oscs="$cleanup_oscs $osc_name"
+            done
+        else
+            client_names_str=$($lctl dl | grep -v mdt | \
+                awk '{if ($2 == "UP" && $3 == "osc") {print $4} }')
+            count=0;
+            for name in $client_names_str; do
+                client_names[$count]=`echo $name | sed 's/-osc-.*$//'`
+                count=$((count+1))
+            done
+
+            host_names_str=$($lctl dl -t | grep -v mdt | \
+                awk '{if ($2 == "UP" && $3 == "osc") {print $7} }')
+            count=0;
+            for name in $host_names_str; do
+                host_names[$count]=`echo $name | sed 's/@.*$//'`
+                count=$((count+1))
+            done
+
+            for (( i = 0; i < $count; i++ )) do
+                setup_osc_for_remote_ost ${host_names[$i]} \
+                                         ${client_names[$i]} $i
+                osc_name=${client_names[$i]}_osc
+                ec_using_osc $osc_name
+               cleanup_oscs="$cleanup_oscs $osc_name"
+            done
+        fi
+
+        echo_clients=$($lctl dl | grep echo_client | awk "{if (\$2 == \"UP\" && \$3 == \"echo_client\") {print \$4} }")
         cnt=0;
         for name in $echo_clients; do
             client_names[$cnt]=$name
@@ -315,21 +329,21 @@ if [ $case == "network" ]; then
     fi
     # Now do the server setup
     setup_srv_obd $server_nid "echo_srv"
-    oss_on_srv=`dsh $server_nid root "lctl dl | grep OSS" | awk '{ print $4 }'`
+    oss_on_srv=`dsh $server_nid root "$lctl dl | grep OSS" | awk '{ print $4 }'`
     if [ -z $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
+    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
+    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)
+    osc_names_str=$($lctl dl| grep osc | grep -v mdt | grep UP)
     if [ -n "$osc_names_str" ]; then
         echo "The existing setup must be cleaned";
         exit 0;
@@ -346,25 +360,15 @@ fi
 # get vmstat started
 # disable portals debug and get obdecho loaded on all relevant hosts
 unique_hosts=(`unique ${host_names[@]}`)
+load_obdechos
 pidcount=0
 for host in ${unique_hosts[@]}; do
     host_vmstatf=${vmstatf}_${host}
     echo -n > $host_vmstatf
-    remote_shell $host "vmstat 5 >> $host_vmstatf" &
+    remote_shell $host "vmstat 5 >> $host_vmstatf" &> /dev/null &
     pid=$!
     vmstatpids[$pidcount]=$pid
     pidcount=$((pidcount+1))
-    do_unload_obdecho[$host]=0
-    if obdecho_loaded $host; then
-        continue
-    fi
-    load_obdecho $host
-    if obdecho_loaded $host; then
-        do_unload_obdecho[$host]=1
-        continue
-        fi
-    echo "Can't load obdecho on $host" 1>&2
-    exit 1
 done
 # get all the echo_client device numbers and names
 for ((i=0; i < $ndevs; i++)); do
@@ -381,6 +385,8 @@ if (($ndevs <= 0 || ${#host_names[@]} <= 0)); then
     echo "no devices or hosts specified"
     cleanup 0 $clean_srv_OSS $cleanup_oscs
 fi
+# Buffers will be spread out among all hosts, so allow for that
+max_buffer_mem=$(( ${max_buffer_mem} * ${#unique_hosts[@]} ))
 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 
@@ -409,7 +415,7 @@ for ((rsz = $rszlo; rsz <= $rszhi; rsz*=2)); do
            actual_size=$((actual_rsz*count*thr))
             total_size=$((actual_size*ndevs))
            # show computed parameters
-           str=`printf 'ost %2d sz %8dK rsz %4d obj %4d thr %4d ' \
+           str=`printf 'ost %2d sz %8dK rsz %4dK obj %4d thr %4d ' \
                     $ndevs $total_size $actual_rsz $total_nobj $total_thr`
            echo "=======================> $str" >> $workf
            print_summary -n "$str"
@@ -480,6 +486,7 @@ for ((rsz = $rszlo; rsz <= $rszhi; rsz*=2)); do
                 for host in ${unique_hosts[@]}; do
                     rm ${cmdsf}_${host}
                 done
+
                # compute bandwidth from total data / elapsed time
                str=`awk "BEGIN {printf \"%7.2f \",\
                         $total_size / (( $t1 - $t0 ) * 1024)}"`
@@ -491,9 +498,10 @@ for ((rsz = $rszlo; rsz <= $rszhi; rsz*=2)); do
                    tmpfi="${tmpf}_$idx"
                    echo "=============> $test $client_name" >> $workf
                    host="${host_names[$idx]}"
-                   remote_shell $host cat $tmpfi >> $workf
-                   get_stats $tmpfi >> $tmpf
-                   rm $tmpfi
+                   remote_shell $host cat $tmpfi > ${tmpfi}_local
+                   cat ${tmpfi}_local >> $workf
+                   get_stats ${tmpfi}_local >> $tmpf
+                   rm -f $tmpfi ${tmpfi}_local
                done
                # compute/display global min/max stats
                echo "=============> $test global" >> $workf