# include library
source libecho
+# The following variables can be set in the environment, or on the
+# command line
+# result file prefix (date/time + hostname makes unique)
+# NB ensure path to it exists
+rslt_loc=${rslt_loc:-"/tmp"}
+rslt=${rslt:-"$rslt_loc/obdfilter_survey_`date +%F@%R`_`uname -n`"}
+
+# Set this true to check file contents
+verify=${verify:-0}
+
+# total size (MBytes) per obd instance
+# large enough to avoid cache effects
+# and to make test startup/shutdown overhead insignificant
+size=${size:-16384}
+
+# record size (KBytes)
+rszlo=${rszlo:-1024}
+rszhi=${rszhi:-1024}
+
+# number of objects per OST
+nobjlo=${nobjlo:-1}
+#was nobjhi=${nobjhi:-512}
+nobjhi=${nobjhi:-16}
+
+# threads per OST (1024 max)
+thrlo=${thrlo:-1}
+thrhi=${thrhi:-16}
+
+# End of variables
+
# create a set of objects, check there are 'n' contiguous ones and
# return the first or 'ERROR'
# parameter: 1. hostname
get_stats () {
local rfile=$1
- awk < $rfile \
+ gawk < $rfile \
'/^Selected device [0-9]+$/ {n = 0; next}\
/error/ {n = -1; exit}\
/^[0-9]+\/[0-9]+ Total: [0-9]+\.[0-9]+\/second$/ {n++; v=strtonum($3); \
done
fi
-# result file prefix (date/time + hostname makes unique)
-# NB ensure path to it exists
-rslt=${rslt:-"/tmp/obdfilter_survey_`date +%F@%R`_`uname -n`"}
# what tests to run (first must be write)
tests_str=${tests_str:-""}
tests=(write rewrite read)
fi
-# Set this true to check file contents
-verify=0
-
-# total size (MBytes) per obd instance
-# large enough to avoid cache effects
-# and to make test startup/shutdown overhead insignificant
-size=${size:-16384}
-
-# record size (KBytes)
-rszlo=${rszlo:-1024}
-rszhi=${rszhi:-1024}
-
-# number of objects per OST
-nobjlo=${nobjlo:-1}
-#was nobjhi=${nobjhi:-512}
-nobjhi=${nobjhi:-16}
-
-# threads per OST (1024 max)
-thrlo=${thrlo:-1}
-thrhi=${thrhi:-16}
-
# restart from here iff all are defined
restart_rsz=
restart_thr=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
echo "Specify the server NID"
exit 1;
fi
- osc_names_string=`ssh root@"$server_nid" 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=`ssh root@"$server_nid" 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)
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
t0=`date +%s.%N`
pidcount=0
for host in ${unique_hosts[@]}; do
- # brutal hack to deal with a non-shared /tmp
- scp -q ${cmdsf}_${host} ${host}:/tmp > /dev/null
- remote_shell $host bash ${cmdsf}_${host} &
+ remote_shell $host bash < ${cmdsf}_${host} &
pidarray[$pidcount]=$!
pidcount=$((pidcount+1))
done
tmpfi="${tmpf}_$idx"
echo "=============> $test $client_name" >> $workf
host="${host_names[$idx]}"
- scp -q ${host}:$tmpfi $tmpfi > /dev/null
- cat $tmpfi >> $workf
+ remote_shell $host cat $tmpfi >> $workf
get_stats $tmpfi >> $tmpf
rm $tmpfi
done
done
done
done
-
-cleanup 0
+cleanup 0 $clean_srv_OSS
exit 0