local rc=0
if ${LST_BATCH_STARTED}; then
- lctl mark "lst stop ${BATCH_NAME}"
+ $LCTL mark "lst stop ${BATCH_NAME}"
[[ -n ${ALL_HOSTS} ]] &&
- $PDSH "${ALL_HOSTS}" "lctl mark \"lst stop ${BATCH_NAME}\""
+ $PDSH "${ALL_HOSTS}" "$LCTL mark 'lst stop ${BATCH_NAME}'"
lst stop "${BATCH_NAME}" || rc=$?
LST_BATCH_STARTED=false
fi
if ${LST_SESSION_CREATED}; then
- lctl mark "Stop LST $MODE"
+ $LCTL mark "Stop LST $MODE"
echo "Stop LST $MODE - $(date)"
[[ -n ${ALL_HOSTS} ]] &&
- $PDSH "${ALL_HOSTS}" "lctl mark \"Stop LST $MODE\""
+ $PDSH "${ALL_HOSTS}" "$LCTL mark 'Stop LST $MODE'"
lst end_session || rc=$((rc + $?))
LST_SESSION_CREATED=false
esac
done
+# find where 'lctl' binary is installed on this system
+if [[ -x "$LCTL" ]]; then # full pathname specified
+ : # echo "LCTL=$LCTL"
+elif [[ -n "$LUSTRE" && -x "$LUSTRE/utils/lctl" ]]; then
+ LCTL=$LUSTRE/utils/lctl
+else # hope that it is in the PATH
+ LCTL=${LCTL:-lctl}
+fi
+#echo "using LCTL='$LCTL' lustre_root='$lustre_root' LUSTRE='$LUSTRE'"
+[[ -n "$(which $LCTL)" ]] || { echo "error: lctl not found"; exit 99; }
+
if [[ -z $CLIENTS ]]; then
echo "Must specify \"clients\" group (-f)"
exit 1
idx=0
opts=( -o NumberOfPasswordPrompts=0 -o ConnectTimeout=5 )
for host in ${SERVERS//,/ }; do
- s_nids[idx]=$(ssh "${opts[@]}" "$host" 'lctl list_nids | head -n 1')
+ s_nids[idx]=$(ssh "${opts[@]}" "$host" '$LCTL list_nids | head -n 1')
if [[ -z ${s_nids[idx]} ]]; then
echo "Failed to determine primary NID of $host"
exit
idx=0
for host in ${CLIENTS//,/ }; do
- c_nids[idx]=$(ssh "${opts[@]}" "${host}" 'lctl list_nids | head -n 1')
+ c_nids[idx]=$(ssh "${opts[@]}" "${host}" '$LCTL list_nids | head -n 1')
if [[ -z ${c_nids[idx]} ]]; then
echo "Failed to determine primary NID of $host"
exit
fi
[[ -n $ALL_HOSTS ]] &&
- $PDSH "$ALL_HOSTS" "lctl mark \"Start LST $MODE\""
+ $PDSH "$ALL_HOSTS" "$LCTL mark 'Start LST $MODE'"
-lctl mark "Start LST $MODE"
+$LCTL mark "Start LST $MODE"
echo "Start LST $MODE - $(date)"
trap 'exit_handler' EXIT
else
dirname="$(printf "${mdtbasedir}" $mdtidx)${basedir}${idx}"
fi
- remote_shell $host $lctl --device $devno test_mkdir /$dirname \
+ remote_shell $host $LCTL --device $devno test_mkdir /$dirname \
-c $dir_stripes --stripe_index $mdtidx > $rfile 2>&1
while read line; do
echo "$line" | grep -q 'error: test_mkdir'
else
dirname="$(printf "${mdtbasedir}" $mdtidx)${basedir}${idx}"
fi
- remote_shell $host $lctl --device $devno test_rmdir /$dirname > $rfile 2>&1
+ remote_shell $host $LCTL --device $devno test_rmdir /$dirname > $rfile 2>&1
done
}
unset lustre_root
fi
-if [ -z "$lustre_root" ]; then
- lctl=lctl
-else
- lctl=${lustre_root}/utils/lctl
+# find where 'lctl' binary is installed on this system
+if [[ -x "$LCTL" ]]; then # full pathname specified
+ : # echo "LCTL=$LCTL"
+elif [[ -n "$lustre_root" && -x "$lustre_root/utils/lctl" ]]; then
+ LCTL=${lustre_root}/utils/lctl
+elif [[ -n "$LUSTRE" && -x "$LUSTRE/utils/lctl" ]]; then
+ LCTL=$LUSTRE/utils/lctl
+else # hope that it is in the PATH
+ LCTL=${LCTL:-lctl}
fi
+[[ -n "$(which $LCTL)" ]] || { echo "error: lctl not found"; exit 99; }
declare -a client_names
declare -a host_names
declare -a client_indexes
if [ -z "$targets" ]; then
- targets=$($lctl device_list | awk "{if (\$2 == \"UP\" && \
+ targets=$($LCTL device_list | awk "{if (\$2 == \"UP\" && \
\$3 == \"mdt\") {print \$4} }")
if [ -z "$targets" ]; then
echo "Can't find any MDT to test. Please set targets=..."
if (( $stripe_count > 0 )); then
for ((i=0; i < $ndevs; i++)); do
host=${host_names[$i]}
- obd=$(remote_shell $host $lctl device_list |
+ obd=$(remote_shell $host $LCTL device_list |
awk "{ if (\$2 == \"UP\" &&
(\$3 == \"osc\" || \$3 == \"osp\"))
{ print \$4 } }")
tmpfi="${tmpf}_$idx"
[ "$test" = "create" ] && test="create -c $stripe_count"
echo >> ${cmdsf}_${host} \
- "$lctl > $tmpfi 2>&1 \
+ "$LCTL > $tmpfi 2>&1 \
--threads $thr -$snap $devno test_$test \
-d /$dirname -D $dir_count \
-b $start_number -n $file_count_per_thread"
local type=$2
local name=$3
- remote_shell $host $lctl device_list |
+ remote_shell $host $LCTL device_list |
awk "{if (\$2 == \"UP\" && \$3 == \"$type\" && \$4 == \"$name\") {\
print \$1; exit}}"
}
cleanup_network () {
local clean_srv_OSS=$1
- $lctl <<-EOF
+ $LCTL <<-EOF
--device echotmp cleanup
--device echotmp detach
EOF
remote_shell "root@$server_nid" \
- "$lctl <<-EOF
+ "$LCTL <<-EOF
--device echo_srv cleanup
--device echo_srv detach
EOF"
if [ $clean_srv_OSS ]; then
remote_shell "root@$server_nid" \
- "$lctl <<-EOF
+ "$LCTL <<-EOF
--device OSS cleanup
--device OSS detach
EOF"
fi
client_name=${ost_name}_ecc
# Only 'attach' if '{client_name}_uuid' not already present
- if ! [[ $(lctl dl) =~ $client_name ]]; then
+ if ! [[ $($LCTL dl) =~ $client_name ]]; then
remote_shell $host \
- "$lctl <<-EOF
+ "$LCTL <<-EOF
attach echo_client $client_name \
${client_name}_UUID
setup $ost_name $stack_type
local oscname=$2
local oscuuid=$3
- $lctl add_uuid echo_UUID $server_nid@$NETTYPE >/dev/null 2>&1
- $lctl <<-EOF
+ $LCTL add_uuid echo_UUID $server_nid@$NETTYPE >/dev/null 2>&1
+ $LCTL <<-EOF
attach osc $oscname $oscuuid
--device $oscname setup echo_srv_UUID echo_UUID
EOF
- $lctl <<-EOF
+ $LCTL <<-EOF
attach echo_client ${oscname}_ecc $oscuuid
--device ${oscname}_ecc setup $oscname
EOF
local test_ostfsnm=$2
remote_shell "root@$server_nid" \
- "$lctl <<-EOF
+ "$LCTL <<-EOF
attach obdecho $test_ostfsnm ${test_ostfsnm}_UUID
--device $test_ostfsnm setup
EOF"
local server_nid=$1
remote_shell "root@$server_nid" \
- "$lctl <<-EOF
+ "$LCTL <<-EOF
attach ost OSS OSS_UUID
--device OSS setup
EOF"
local client_name=$2
remote_shell $host \
- "$lctl <<-EOF
+ "$LCTL <<-EOF
--device $client_name cleanup
--device $client_name detach
EOF"
check_cleanup () {
local type_obj="$1"
- local osc_names_str=$($lctl dl | grep $type_obj)
+ local osc_names_str=$($LCTL dl | grep $type_obj)
local count=0;
for name in $osc_names_str; do
check_setup () {
local type_obj="$1"
- local osc_names_str=$($lctl dl | grep $type_obj)
+ local osc_names_str=$($LCTL dl | grep $type_obj)
local count=0;
for name in $osc_names_str; do
# added from bugzill req.
get_targets () {
if [ -z "$ost_names" ]; then
- targets=$($lctl device_list | awk "{if (\$2 == \"UP\" && \
+ targets=$($LCTL device_list | awk "{if (\$2 == \"UP\" && \
\$3 == \"obdfilter\") {print \$4} }")
fi
if [ -z "$targets" ]; then
local nobj=$3
local rfile=$4
- remote_shell $host $lctl --device $devno create $nobj > $rfile 2>&1
+ remote_shell $host $LCTL --device $devno create $nobj > $rfile 2>&1
first=0
prev=0
count=0
local nobj=$4
local rfile=$5
- remote_shell $host $lctl --device $devno destroy $obj0 $nobj > $rfile 2>&1
+ remote_shell $host $LCTL --device $devno destroy $obj0 $nobj > $rfile 2>&1
}
get_stats () {
echo $minusn "$*"
}
-# Return a numeric version code based on a version string. The version
-# code is useful for comparison two version strings to see which is newer.
-version_code() {
- # split arguments like "2.3.61" into "2", "3", "61"
- eval set -- $(tr "[:punct:]" " " <<< $*)
- echo -n "$((($1 << 16) | ($2 << 8) | $3))"
-}
-
-# inspired from the lustre_build_version routine in test-framework.sh
-get_lustre_version() {
- local host=${1:-${unique_hosts[0]}}
- local ver
-
- ver=$(remote_shell $host "$lctl get_param -n version 2>/dev/null ||
- $lctl lustre_build_version 2>/dev/null ||
- $lctl --version 2>/dev/null | cut -d' ' -f2")
- local lver=$(egrep -i "lustre: |version: " <<<$ver | head -n 1)
- [ -n "$lver" ] && ver="$lver"
-
- sed -e 's/.*: //' -e 's/^v//' -e 's/-.*//' -e 's/_/./g' <<<$ver |
- cut -d. -f1-4
-}
-
# Check whether the record size (KBytes) exceeds the maximum bulk I/O RPC size
# or not.
check_record_size() {
- [ $(version_code $(get_lustre_version)) -lt $(version_code 2.3.61) ] &&
- rszmax=1024
-
if [ "$rszhi" -gt "$rszmax" ]; then
- echo "Test disk case support maximum ${rszmax}KB IO data" \
+ echo "Test disk case support maximum ${rszmax}KB IO data " \
"(rszhi=$rszhi is too big), please use a smaller value."
return 1
fi
unset lustre_root
fi
-if [ -z "$lustre_root" ]; then
- lctl=${LCTL:-lctl}
-else
- lctl=${lustre_root}/utils/lctl
+# find where 'lctl' binary is installed on this system
+if [[ -x "$LCTL" ]]; then # full pathname specified
+ : # echo "LCTL=$LCTL"
+elif [[ -n "$lustre_root" && -x "$lustre_root/utils/lctl" ]]; then
+ # echo "lustre_root=$lustre_root"
+ LCTL=${lustre_root}/utils/lctl
+elif [[ -n "$LUSTRE" && -x "$LUSTRE/utils/lctl" ]]; then
+ # echo "LUSTRE=$LUSTRE"
+ LCTL=$LUSTRE/utils/lctl
+else # hope that it is in the PATH
+ # echo "PATH=$PATH"
+ LCTL=${LCTL:-lctl}
fi
+echo "using LCTL='$LCTL' lustre_root='$lustre_root' LUSTRE='$LUSTRE'"
+[[ -n "$(which $LCTL)" ]] || { echo "error: lctl not found"; exit 99; }
# split out hostnames from client/ost names
ndevs=0
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" | awk '/OSS/ { 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| grep osc | grep -v mdt | grep UP || true)
+ osc_names_str=$($LCTL dl| grep osc | grep -v mdt | grep UP || true)
if [ -n "$osc_names_str" ]; then
echo "The existing setup must be cleaned";
exit 0;
declare -a pidarray
for host in ${unique_hosts[@]}; do
remote_shell $host \
- "lctl set_param -n osd*.*.force_sync 1 &>/dev/null || true"
+ "$LCTL set_param -n osd*.*.force_sync 1 &>/dev/null || true"
echo "starting run for test: $test rsz: $rsz " \
"threads: $thr objects: $nobj" >> ${vmstatf}_${host}
done
first_obj=${first_objs[$idx]}
thr_per_obj=$((${thr}/${nobj}))
echo >> ${cmdsf}_${host} \
- "$lctl > $tmpfi 2>&1 \\
+ "$LCTL > $tmpfi 2>&1 \\
--threads $thr -$snap $devno \\
test_brw $count $(testname2type $test) q $pages \\
${thr_per_obj}t${first_obj} $(testcase2mode)$pages &"
size=${size:-1024}
thrlo=${thrlo:-$(( thrhi / 2))}
-OBDSURVEY=${OBDSURVEY:-$(which obdfilter-survey)}
+if [[ -x "$OBDSURVEY" ]]; then
+ echo "OBDSURVEY=$OBDSURVEY"
+elif [[ -x $LUSTRE/../lustre-iokit/obdfilter-survey/obdfilter-survey ]]; then
+ echo "LUSTRE=$LUSTRE"
+ OBDSURVEY="$LUSTRE/../lustre-iokit/obdfilter-survey/obdfilter-survey"
+else
+ OBDSURVEY=${OBDSURVEY:-$(which obdfilter-survey)}
+ echo "OBDSURVEY==$OBDSURVEY"
+fi
check_and_setup_lustre
for osc in $($LCTL get_param -N osc.${FSNAME}-*osc-*); do
nid=$($LCTL get_param $osc.import |
- awk '/current_connection:/ {sub(/@.*/,""); print $2}')
+ awk '/current_connection:/ {sub(/@.*/,""); \
+ sub(/"/,""); print $2}')
dev=$(echo $osc | sed -e 's/^osc\.//' -e 's/-osc.*//')
target=$dev
rm -f ${TMP}/obdfilter_survey*
local targets=$(obdflter_survey_targets $case)
- local cmd="NETTYPE=$NETTYPE thrlo=$thrlo nobjhi=$nobjhi thrhi=$thrhi size=$size case=$case rslt_loc=${TMP} targets=\"$targets\" $OBDSURVEY"
+ local cmd="NETTYPE=$NETTYPE LCTL=$LCTL thrlo=$thrlo nobjhi=$nobjhi thrhi=$thrhi size=$size case=$case rslt_loc=${TMP} targets=\"$targets\" $OBDSURVEY"
echo + $cmd
eval $cmd
local rc=$?