+# 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
+ exit 1
+fi
+
+rsltf="${rslt}.summary"
+workf="${rslt}.detail"
+cmdsf="${rslt}.script"
+vmstatf="${rslt}.vmstat"
+echo -n > $rsltf
+echo -n > $workf
+
+# hide a little trick to unset this from the command line
+if [ "$lustre_root" == " " ]; then
+ unset lustre_root
+fi
+
+if [ -z "$lustre_root" ]; then
+ lctl=lctl
+else
+ lctl=${lustre_root}/utils/lctl
+fi
+
+# split out hostnames from client/ost names
+ndevs=0
+for trgt in $targets; do
+ str=(`split_hostname $trgt`)
+ host_names[$ndevs]=${str[0]}
+ client_names[$ndevs]=${str[1]}
+ ndevs=$((ndevs+1))
+done
+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
+ 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} }")
+ cnt=0;
+ for name in $echo_clients; do
+ client_names[$cnt]=$name
+ host_names[$cnt]=localhost
+ cnt=$((cnt+1))
+ done
+ ndevs=${#client_names[@]}
+fi
+if [ $case == "network" ]; then
+ server_nid=$targets
+ if [ -z "$server_nid" ]; then
+ echo "Specify hostname or ip-address of server"
+ exit 1;
+ fi
+ # 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 "echo_srv"
+ 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
+ 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)
+ if [ -n "$osc_names_str" ]; then
+ echo "The existing setup must be cleaned";
+ exit 0;
+ fi
+ ec_using_srv_nid $server_nid "echotmp" "echotmp_UUID"
+ client_names[0]="echotmp_ecc"
+fi
+if [ -z "$targets" ]; then
+ if [ $case == "disk" ]; then
+ get_targets
+ ndevs=${#ost_names[@]}
+ fi
+fi