if ! echo $PATH | grep -q $LUSTRE/tests; then
export PATH=$LUSTRE/tests:$PATH
fi
+ if ! echo $PATH | grep -q $LUSTRE/../lustre-iokit/sgpdd-survey; then
+ export PATH=$PATH:$LUSTRE/../lustre-iokit/sgpdd-survey
+ fi
export LST=${LST:-"$LUSTRE/../lnet/utils/lst"}
[ ! -f "$LST" ] && export LST=$(which lst)
+ export SGPDDSURVEY=${SGPDDSURVEY:-"$LUSTRE/../lustre-iokit/sgpdd-survey/sgpdd-survey")}
+ [ ! -f "$SGPDDSURVEY" ] && export SGPDDSURVEY=$(which sgpdd-survey)
+ # Ubuntu, at least, has a truncate command in /usr/bin
+ # so fully path our truncate command.
+ export TRUNCATE=${TRUNCATE:-$LUSTRE/tests/truncate}
export MDSRATE=${MDSRATE:-"$LUSTRE/tests/mpi/mdsrate"}
[ ! -f "$MDSRATE" ] && export MDSRATE=$(which mdsrate 2> /dev/null)
if ! echo $PATH | grep -q $LUSTRE/tests/racer; then
export RPWD=${RPWD:-$PWD}
export I_MOUNTED=${I_MOUNTED:-"no"}
if [ ! -f /lib/modules/$(uname -r)/kernel/fs/lustre/mds.ko -a \
+ ! -f /lib/modules/$(uname -r)/updates/kernel/fs/lustre/mds.ko -a \
! -f `dirname $0`/../mds/mds.ko ]; then
export CLIENTMODSONLY=yes
fi
+ export SHUTDOWN_ATTEMPTS=${SHUTDOWN_ATTEMPTS:-3}
+
# command line
while getopts "rvwf:" opt $*; do
load_module mgc/mgc
if ! client_only; then
grep -q crc16 /proc/kallsyms || { modprobe crc16 2>/dev/null || true; }
- grep -q jbd /proc/kallsyms || { modprobe jbd 2>/dev/null || true; }
+ grep -q -w jbd /proc/kallsyms || { modprobe jbd 2>/dev/null || true; }
+ grep -q -w jbd2 /proc/kallsyms || { modprobe jbd2 2>/dev/null || true; }
[ "$FSTYPE" = "ldiskfs" ] && load_module ../ldiskfs/ldiskfs/ldiskfs
load_module mgs/mgs
load_module mds/mds
}
# Facet functions
+mount_facets () {
+ local facets=${1:-$(get_facets)}
+ local facet
+
+ for facet in ${facets//,/ }; do
+ mount_facet $facet || error "Restart of $facet failed!"
+ done
+}
+
mount_facet() {
local facet=$1
shift
local dev=$(facet_active $facet)_dev
local opt=${facet}_opt
- echo "Starting ${facet}: ${!opt} $@ ${!dev} ${MOUNT%/*}/${facet}"
- do_facet ${facet} mount -t lustre ${!opt} $@ ${!dev} ${MOUNT%/*}/${facet}
+ local mntpt=$(facet_mntpt $facet)
+
+ echo "Starting ${facet}: ${!opt} $@ ${!dev} $mntpt"
+ do_facet ${facet} "mkdir -p $mntpt; mount -t lustre ${!opt} $@ ${!dev} $mntpt"
RC=${PIPESTATUS[0]}
if [ $RC -ne 0 ]; then
- echo "mount -t lustre $@ ${!dev} ${MOUNT%/*}/${facet}"
+ echo "mount -t lustre $@ ${!dev} $mntpt"
echo "Start of ${!dev} on ${facet} failed ${RC}"
else
do_facet ${facet} "lctl set_param debug=\\\"$PTLDEBUG\\\"; \
eval export ${facet}failover_dev=$device
fi
- do_facet ${facet} mkdir -p ${MOUNT%/*}/${facet}
+ local mntpt=$(facet_mntpt $facet)
+ do_facet ${facet} mkdir -p $mntpt
+ eval export ${facet}_MOUNT=$mntpt
mount_facet ${facet}
RC=$?
return $RC
local running
local facet=$1
shift
- HOST=`facet_active_host $facet`
+ local HOST=`facet_active_host $facet`
[ -z $HOST ] && echo stop: no host for $facet && return 0
- running=$(do_facet ${facet} "grep -c ${MOUNT%/*}/${facet}' ' /proc/mounts") || true
+ local mntpt=$(facet_mntpt $facet)
+ running=$(do_facet ${facet} "grep -c $mntpt' ' /proc/mounts") || true
if [ ${running} -ne 0 ]; then
- echo "Stopping ${MOUNT%/*}/${facet} (opts:$@)"
- do_facet ${facet} umount -d $@ ${MOUNT%/*}/${facet}
+ echo "Stopping $mntpt (opts:$@)"
+ do_facet ${facet} umount -d $@ $mntpt
fi
# umount should block, but we should wait for unrelated obd's
[ -n "$type" ] && { $LFS quotacheck -$type $MOUNT || error "quotacheck has failed"; }
- do_facet mgs "lctl conf_param mdd.${fsname}-MDT*.quota_type=$spec"
+ do_facet mgs "lctl conf_param ${fsname}-MDT*.mdd.quota_type=$spec"
local varsvc
local osts=$(get_facets OST)
for ost in ${osts//,/ }; do
varsvc=${ost}_svc
- do_facet mgs "lctl conf_param ost.${!varsvc}.quota_type=$spec"
+ do_facet mgs "lctl conf_param ${!varsvc}.ost.quota_type=$spec"
done
}
# FIXME: modify get_facets to display all facets wo params
local facets="$(get_facets OST),$(get_facets MDS),mgs"
local node
- local mnt
+ local mntpt
local facet
for facet in ${facets//,/ }; do
node=$(facet_host ${facet})
- mnt=${MOUNT%/*}/${facet}
- sanity_mount_check_nodes $node $mnt ||
+ mntpt=$(facet_mntpt $facet)
+ sanity_mount_check_nodes $node $mntpt ||
{ error "server $node environments are insane!"; return 1; }
done
}
fi"
}
-shudown_node_hard () {
+shutdown_node () {
+ local node=$1
+ echo + $POWER_DOWN $node
+ $POWER_DOWN $node
+}
+
+shutdown_node_hard () {
local host=$1
- local attempts=3
+ local attempts=$SHUTDOWN_ATTEMPTS
for i in $(seq $attempts) ; do
- $POWER_DOWN $host
+ shutdown_node $host
sleep 1
- ping -w 3 -c 1 $host > /dev/null 2>&1 || return 0
+ wait_for_function --quiet "! ping -w 3 -c 1 $host" 5 1 && return 0
echo "waiting for $host to fail attempts=$attempts"
[ $i -lt $attempts ] || \
{ echo "$host still pingable after power down! attempts=$attempts" && return 1; }
local attempts=3
if [ "$FAILURE_MODE" = HARD ]; then
- shudown_node_hard $client
+ shutdown_node_hard $client
else
zconf_umount_clients $client $mnt -f
fi
}
+facets_on_host () {
+ local host=$1
+ local facets="$(get_facets OST),$(get_facets MDS)"
+ local affected
+
+ combined_mgs_mds || facets="$facets,mgs"
+
+ for facet in ${facets//,/ }; do
+ if [ $(facet_active_host $facet) == $host ]; then
+ affected="$affected $facet"
+ fi
+ done
+
+ echo $(comma_list $affected)
+}
+
+facet_up () {
+ local facet=$1
+ local host=${2:-$(facet_host $facet)}
+
+ local label=$(convert_facet2label $facet)
+ do_node $host lctl dl | awk '{print $4}' | grep -q $label
+}
+
+facets_up_on_host () {
+ local host=$1
+ local facets=$(facets_on_host $host)
+ local affected_up
+
+ for facet in ${facets//,/ }; do
+ if $(facet_up $facet $host); then
+ affected_up="$affected_up $facet"
+ fi
+ done
+
+ echo $(comma_list $affected_up)
+}
+
shutdown_facet() {
local facet=$1
+
if [ "$FAILURE_MODE" = HARD ]; then
- shudown_node_hard $(facet_active_host $facet)
- elif [ "$FAILURE_MODE" = SOFT ]; then
+ shutdown_node_hard $(facet_active_host $facet)
+ else
stop $facet
fi
}
+reboot_node() {
+ local node=$1
+ echo + $POWER_UP $node
+ $POWER_UP $node
+}
+
remount_facet() {
local facet=$1
}
reboot_facet() {
- facet=$1
+ local facet=$1
if [ "$FAILURE_MODE" = HARD ]; then
- $POWER_UP `facet_active_host $facet`
+ reboot_node $(facet_active_host $facet)
else
sleep 10
fi
boot_node() {
local node=$1
if [ "$FAILURE_MODE" = HARD ]; then
- $POWER_UP $node
+ reboot_node $node
wait_for_host $node
fi
}
-# recovery-scale functions
+facets_hosts () {
+ local facets=$1
+ local hosts
+
+ for facet in ${facets//,/ }; do
+ hosts=$(expand_list $hosts $(facet_host $facet) )
+ done
+
+ echo $hosts
+}
+
+_check_progs_installed () {
+ local progs=$@
+ local rc=0
+
+ for prog in $progs; do
+ if ! [ "$(which $prog)" -o "${!prog}" ]; then
+ echo $prog missing on $(hostname)
+ rc=1
+ fi
+ done
+ return $rc
+}
+
check_progs_installed () {
- local clients=$1
+ local nodes=$1
shift
- local progs=$@
- do_nodes $clients "PATH=:$PATH; status=true;
-for prog in $progs; do
- if ! [ \\\"\\\$(which \\\$prog)\\\" -o \\\"\\\${!prog}\\\" ]; then
- echo \\\$prog missing on \\\$(hostname);
- status=false;
- fi
-done;
-eval \\\$status"
+ do_rpc_nodes $nodes _check_progs_installed $@
}
+# recovery-scale functions
client_var_name() {
echo __$(echo $1 | tr '-' 'X')
}
}
wait_for_host() {
- local host=$1
- check_network "$host" 900
- while ! do_node $host hostname > /dev/null; do sleep 5; done
+ local hostlist=$1
+
+ # we can use "for" here because we are waiting the slowest
+ for host in ${hostlist//,/ }; do
+ check_network "$host" 900
+ done
+ while ! do_nodes $hostlist hostname > /dev/null; do sleep 5; done
}
-wait_for() {
- local facet=$1
- local host=`facet_active_host $facet`
- wait_for_host $host
+wait_for_facet() {
+ local facetlist=$1
+ local hostlist
+
+ for facet in ${facetlist//,/ }; do
+ hostlist=$(expand_list $hostlist $(facet_active_host $facet))
+ done
+ wait_for_host $hostlist
}
-wait_recovery_complete () {
- local facet=$1
+_wait_recovery_complete () {
+ local param=$1
# Use default policy if $2 is not passed by caller.
local MAX=${2:-$(max_recovery_time)}
- local var_svc=${facet}_svc
- local procfile="*.${!var_svc}.recovery_status"
local WAIT=0
local STATUS=
while [ $WAIT -lt $MAX ]; do
- STATUS=$(do_facet $facet lctl get_param -n $procfile | grep status)
- [[ $STATUS = "status: COMPLETE" ]] && return 0
+ STATUS=$(lctl get_param -n $param | grep status)
+ echo $param $STATUS
+ [[ $STATUS = "status: COMPLETE" || $STATUS = "status: INACTIVE" ]] && return 0
sleep 5
WAIT=$((WAIT + 5))
- echo "Waiting $((MAX - WAIT)) secs for $facet recovery done. $STATUS"
+ echo "Waiting $((MAX - WAIT)) secs for $param recovery done. $STATUS"
done
- echo "$facet recovery not done in $MAX sec. $STATUS"
+ echo "$param recovery not done in $MAX sec. $STATUS"
return 1
}
+wait_recovery_complete () {
+ local facet=$1
+
+ # with an assumption that at_max is the same on all nodes
+ local MAX=${2:-$(max_recovery_time)}
+
+ local facets=$facet
+ if [ "$FAILURE_MODE" = HARD ]; then
+ facets=$(facets_on_host $(facet_active_host $facet))
+ fi
+ echo affected facets: $facets
+
+ # we can use "for" here because we are waiting the slowest
+ for facet in ${facets//,/ }; do
+ local var_svc=${facet}_svc
+ local param="*.${!var_svc}.recovery_status"
+
+ local host=$(facet_active_host $facet)
+ do_rpc_nodes $host _wait_recovery_complete $param $MAX
+ done
+}
+
wait_mds_ost_sync () {
# just because recovery is done doesn't mean we've finished
# orphan cleanup. Wait for llogs to get synchronized.
rm $MOUNT/recon
}
+affected_facets () {
+ local facet=$1
+
+ local host=$(facet_active_host $facet)
+ local affected=$facet
+
+ if [ "$FAILURE_MODE" = HARD ]; then
+ affected=$(facets_up_on_host $host)
+ fi
+ echo $affected
+}
+
facet_failover() {
local facet=$1
local sleep_time=$2
- echo "Failing $facet on node `facet_active_host $facet`"
+ local host=$(facet_active_host $facet)
+
+ echo "Failing $facet on node $host"
+
+ local affected=$(affected_facets $facet)
+
shutdown_facet $facet
+
+ echo affected facets: $affected
+
[ -n "$sleep_time" ] && sleep $sleep_time
+
reboot_facet $facet
- change_active $facet
- local TO=`facet_active_host $facet`
- echo "Failover $facet to $TO"
- wait_for $facet
- mount_facet $facet || error "Restart of $facet failed"
+
+ change_active $affected
+
+ wait_for_facet $affected
+ # start mgs first if it is affected
+ if ! combined_mgs_mds && list_member $affected mgs; then
+ mount_facet mgs || error "Restart of mgs failed"
+ fi
+ # FIXME; has to be changed to mount all facets concurrently
+ affected=$(exclude_items_from_list $affected mgs)
+ mount_facets $affected
}
obd_name() {
}
declare -fx h2elan
-h2openib() {
- h2name_or_ip "$1" "openib"
-}
-declare -fx h2openib
-
h2o2ib() {
h2name_or_ip "$1" "o2ib"
}
}
change_active() {
- local facet=$1
+ local facetlist=$1
+ local facet
+
+ facetlist=$(exclude_items_from_list $facetlist mgs)
+
+ for facet in ${facetlist//,/ }; do
local failover=${facet}failover
- host=`facet_host $failover`
+ local host=`facet_host $failover`
[ -z "$host" ] && return
+
local curactive=`facet_active $facet`
if [ -z "${curactive}" -o "$curactive" == "$failover" ] ; then
eval export ${facet}active=$facet
# save the active host for this facet
local activevar=${facet}active
echo "$activevar=${!activevar}" > $TMP/$activevar
+ local TO=`facet_active_host $facet`
+ echo "Failover $facet to $TO"
+ done
}
do_node() {
echo -n $DEVPTR
}
+facet_mntpt () {
+ local facet=$1
+ local var=${facet}_MOUNT
+ eval mntpt=${!var:-${MOUNT%/*}/$facet}
+
+ echo -n $mntpt
+}
+
########
## MountConf setup
cleanup_gss
}
-mdsmkfsopts()
-{
- local nr=$1
- test $nr = 1 && echo -n $MDS_MKFS_OPTS || echo -n $MDSn_MKFS_OPTS
-}
-
combined_mgs_mds () {
[[ $MDSDEV1 = $MGSDEV ]] && [[ $mds1_HOST = $mgs_HOST ]]
}
+mkfs_opts () {
+ local facet=$1
+
+ local tgt=$(echo $facet | tr -d [:digit:] | tr "[:lower:]" "[:upper:]")
+ local optvar=${tgt}_MKFS_OPTS
+ local opt=${!optvar}
+
+ # FIXME: ! combo mgs/mds + mgsfailover is not supported yet
+ [[ $facet = mgs ]] && echo $opt && return
+
+ # 1.
+ # --failnode options
+ local var=${facet}failover_HOST
+ if [ x"${!var}" != x ] && [ x"${!var}" != x$(facet_host $facet) ] ; then
+ local failnode=$(h2$NETTYPE ${!var})
+ failnode="--failnode=$failnode"
+ # options does not contain
+ # or contains wrong --failnode=
+ if [[ $opt != *${failnode}* ]]; then
+ opt=$(echo $opt | sed 's/--failnode=.* / /')
+ opt="$opt $failnode"
+ fi
+ fi
+
+ # 2.
+ # --mgsnode options
+ # no additional mkfs mds "--mgsnode" option for this configuration
+ if [[ $facet = mds ]] && combined_mgs_mds; then
+ echo $opt
+ return
+ fi
+
+ # additional mkfs "--mgsnode"
+ local mgsnode="--mgsnode=$MGSNID"
+ opt=${opt//$mgsnode }
+ for nid in ${MGSNID//:/ }; do
+ local mgsnode="--mgsnode=$nid"
+ # options does not contain
+ # --mgsnode=$nid
+ if [[ $opt != *${mgsnode}" "* ]]; then
+ opt="$opt --mgsnode=$nid"
+ fi
+ done
+
+ echo $opt
+}
+
formatall() {
if [ "$IAMDIR" == "yes" ]; then
MDS_MKFS_OPTS="$MDS_MKFS_OPTS --iam-dir"
- MDSn_MKFS_OPTS="$MDSn_MKFS_OPTS --iam-dir"
fi
[ "$FSTYPE" ] && FSTYPE_OPT="--backfstype $FSTYPE"
[ "$CLIENTONLY" ] && return
echo Formatting mgs, mds, osts
if ! combined_mgs_mds ; then
- add mgs $mgs_MKFS_OPTS $FSTYPE_OPT --reformat $MGSDEV || exit 10
+ add mgs $(mkfs_opts mgs) $FSTYPE_OPT --reformat $MGSDEV || exit 10
fi
for num in `seq $MDSCOUNT`; do
echo "Format mds$num: $(mdsdevname $num)"
if $VERBOSE; then
- add mds$num `mdsmkfsopts $num` $FSTYPE_OPT --reformat `mdsdevname $num` || exit 9
+ add mds$num $(mkfs_opts mds) $FSTYPE_OPT --reformat $(mdsdevname $num) || exit 10
else
- add mds$num `mdsmkfsopts $num` $FSTYPE_OPT --reformat `mdsdevname $num` > /dev/null || exit 9
+ add mds$num $(mkfs_opts mds) $FSTYPE_OPT --reformat $(mdsdevname $num) > /dev/null || exit 10
fi
done
+ # the ost-s could have different OST_MKFS_OPTS
+ # because of different failnode-s
for num in `seq $OSTCOUNT`; do
echo "Format ost$num: $(ostdevname $num)"
if $VERBOSE; then
- add ost$num $OST_MKFS_OPTS --reformat `ostdevname $num` || exit 10
+ add ost$num $(mkfs_opts ost${num}) $FSTYPE_OPT --reformat `ostdevname $num` || exit 10
else
- add ost$num $OST_MKFS_OPTS --reformat `ostdevname $num` > /dev/null || exit 10
+ add ost$num $(mkfs_opts ost${num}) $FSTYPE_OPT --reformat `ostdevname $num` > /dev/null || exit 10
fi
done
}
echo $WRITECONF | grep -q "writeconf" && \
writeconf_all
if ! combined_mgs_mds ; then
- start mgs $MGSDEV $mgs_MOUNT_OPTS
+ start mgs $MGSDEV $MGS_MOUNT_OPTS
fi
for num in `seq $MDSCOUNT`; do
else
eval export ${facet}failover_dev=$device
fi
+
+ # get mount point of already mounted device
+ # is facet_dev is already mounted then use the real
+ # mount point of this facet; otherwise use $(facet_mntpt $facet)
+ # i.e. ${facet}_MOUNT if specified by user or default
+ local mntpt=$(do_facet ${facet} cat /proc/mounts | \
+ awk '"'${!dev}'" == $1 && $3 == "lustre" { print $2 }')
+ if [ -z $mntpt ]; then
+ mntpt=$(facet_mntpt $facet)
+ fi
+ eval export ${facet}_MOUNT=$mntpt
}
init_facets_vars () {
done
fi
+ combined_mgs_mds || init_facet_vars mgs $MGSDEV $MGS_MOUNT_OPTS
+
remote_ost_nodsh && return
for num in `seq $OSTCOUNT`; do
#######
# General functions
-check_network() {
- local NETWORK=0
- local WAIT=0
- local MAX=$2
- while [ $NETWORK -eq 0 ]; do
- if ping -c 1 -w 3 $1 > /dev/null; then
- NETWORK=1
- else
- WAIT=$((WAIT + 5))
- echo "waiting for $1, $((MAX - WAIT)) secs left"
- sleep 5
- fi
- if [ $WAIT -gt $MAX ]; then
- echo "Network not available"
- exit 1
- fi
+wait_for_function () {
+ local quiet=""
+
+ # suppress fn both stderr and stdout
+ if [ "$1" = "--quiet" ]; then
+ shift
+ quiet=" > /dev/null 2>&1"
+
+ fi
+
+ local fn=$1
+ local max=${2:-900}
+ local sleep=${3:-5}
+
+ local wait=0
+
+ while true; do
+
+ eval $fn $quiet && return 0
+
+ wait=$((wait + sleep))
+ [ $wait -lt $max ] || return 1
+ echo waiting $fn, $((max - wait)) secs left ...
+ sleep $sleep
done
}
-check_port() {
- while( !($DSH2 $1 "netstat -tna | grep -q $2") ) ; do
- sleep 9
- done
+
+check_network() {
+ local host=$1
+ local max=$2
+ local sleep=${3:-5}
+
+ echo `date +"%H:%M:%S (%s)"` waiting for $host network $max secs ...
+ if ! wait_for_function --quiet "ping -c 1 -w 3 $host" $max $sleep ; then
+ echo "Network not available!"
+ exit 1
+ fi
+
+ echo `date +"%H:%M:%S (%s)"` network interface is UP
}
no_dsh() {
echo "$*" | tr -s " " "\n" | sort -b -u | tr "\n" " " | sed 's/ \([^$]\)/,\1/g'
}
+list_member () {
+ local list=$1
+ local item=$2
+ echo $list | grep -qw $item
+}
+
# list, excluded are the comma separated lists
exclude_items_from_list () {
local list=$1
for item in ${excluded//,/ }; do
list=$(echo " $list " | sed -re "s/\s+$item\s+/ /g")
done
- echo $(comma_list $list)
+ echo $(comma_list $list)
}
# list, expand are the comma separated lists
}
get_facets () {
- local name=$(echo $1 | tr "[:upper:]" "[:lower:]")
- local type=$(echo $1 | tr "[:lower:]" "[:upper:]")
+ local types=${1:-"OST MDS MGS"}
local list=""
- local count=${type}COUNT
- for ((i=1; i<=${!count}; i++)) do
- list="$list ${name}$i"
+
+ for entry in $types; do
+ local name=$(echo $entry | tr "[:upper:]" "[:lower:]")
+ local type=$(echo $entry | tr "[:lower:]" "[:upper:]")
+
+ case $type in
+ MGS ) list="$list $name";;
+ MDS|OST ) local count=${type}COUNT
+ for ((i=1; i<=${!count}; i++)) do
+ list="$list ${name}$i"
+ done;;
+ * ) error "Invalid facet type"
+ exit 1;;
+ esac
done
echo $(comma_list $list)
}
(cd `dirname $1`; echo $PWD/`basename $1`)
}
-sync_clients() {
- [ -d $DIR1 ] && cd $DIR1 && sync; sleep 1; sync
- [ -d $DIR2 ] && cd $DIR2 && sync; sleep 1; sync
- cd $SAVE_PWD
-}
check_grant() {
export base=`basetest $1`
[ ${!testname}x == x ] && return 0
echo -n "checking grant......"
- cd $SAVE_PWD
- # write some data to sync client lost_grant
- rm -f $DIR1/${tfile}_check_grant_* 2>&1
- for i in `seq $OSTCOUNT`; do
- $LFS setstripe $DIR1/${tfile}_check_grant_$i -i $(($i -1)) -c 1
- dd if=/dev/zero of=$DIR1/${tfile}_check_grant_$i bs=4k \
- count=1 > /dev/null 2>&1
- done
- # sync all the data and make sure no pending data on server
- sync_clients
-
- #get client grant and server grant
- client_grant=0
- for d in `lctl get_param -n osc.*.cur_grant_bytes`; do
- client_grant=$((client_grant + $d))
- done
- server_grant=0
- for d in `lctl get_param -n obdfilter.*.tot_granted`; do
- server_grant=$((server_grant + $d))
- done
- # cleanup the check_grant file
- for i in `seq $OSTCOUNT`; do
- rm $DIR1/${tfile}_check_grant_$i
- done
+ local clients=$CLIENTS
+ [ -z $clients ] && clients=$(hostname)
+
+ # sync all the data and make sure no pending data on server
+ do_nodes $clients sync
+
+ # get client grant
+ client_grant=`do_nodes $clients \
+ "$LCTL get_param -n osc.${FSNAME}-*.cur_*grant_bytes" | \
+ awk '{total += $1} END{print total}'`
+
+ # get server grant
+ server_grant=`do_nodes $(comma_list $(osts_nodes)) \
+ "$LCTL get_param -n obdfilter.${FSNAME}-OST*.tot_granted" | \
+ awk '{total += $1} END{print total}'`
+
+ # check whether client grant == server grant
+ if [ $client_grant -ne $server_grant ]; then
+ echo "failed: client:${client_grant} server: ${server_grant}."
+ do_nodes $(comma_list $(osts_nodes)) \
+ "$LCTL get_param obdfilter.${FSNAME}-OST*.tot*"
+ do_nodes $clients "$LCTL get_param osc.${FSNAME}-*.cur_*_bytes"
+ return 1
+ else
+ echo "pass: client:${client_grant} server: ${server_grant}"
+ fi
- #check whether client grant == server grant
- if [ $client_grant != $server_grant ]; then
- echo "failed: client:${client_grant} server: ${server_grant}"
- return 1
- else
- echo "pass"
- fi
}
########################
echo $ost
}
+ostuuid_from_index()
+{
+ $LFS osts $2 | awk '/^'$1'/ { print $2 }'
+}
+
remote_node () {
local node=$1
[ "$node" != "$(hostname)" ]
remote_ost && remote_mds
}
-osts_nodes () {
- local OSTNODES=$(facet_host ost1)
+facets_nodes () {
+ local facets=$1
+ local nodes
local NODES_sort
- for num in `seq $OSTCOUNT`; do
- local myOST=$(facet_host ost$num)
- OSTNODES="$OSTNODES $myOST"
+ for facet in ${facets//,/ }; do
+ if [ "$FAILURE_MODE" = HARD ]; then
+ nodes="$nodes $(facet_active_host $facet)"
+ else
+ nodes="$nodes $(facet_host $facet)"
+ fi
done
- NODES_sort=$(for i in $OSTNODES; do echo $i; done | sort -u)
+ NODES_sort=$(for i in $nodes; do echo $i; done | sort -u)
echo $NODES_sort
}
+osts_nodes () {
+ local facets=$(get_facets OST)
+ local nodes=$(facets_nodes $facets)
+
+ echo $nodes
+}
+
nodes_list () {
# FIXME. We need a list of clients
local myNODES=$HOSTNAME
[ -n "$CLIENTS" ] && myNODES=${CLIENTS//,/ }
if [ "$PDSH" -a "$PDSH" != "no_dsh" ]; then
- myNODES="$myNODES $(osts_nodes) $(mdts_nodes)"
+ myNODES="$myNODES $(facets_nodes $(get_facets))"
fi
myNODES_sort=$(for i in $myNODES; do echo $i; done | sort -u)
get_clientosc_proc_path() {
local ost=$1
- echo "{$1}-osc-*"
+ echo "${1}-osc-*"
}
get_lustre_version () {
return 0
}
-wait_import_state () {
+_wait_import_state () {
local expected=$1
local CONN_PROC=$2
+ local maxtime=${3:-max_recovery_time}
local CONN_STATE
local i=0
CONN_STATE=$($LCTL get_param -n $CONN_PROC 2>/dev/null | cut -f2)
while [ "${CONN_STATE}" != "${expected}" ]; do
- if [ "${expected}" == "DISCONN" ]; then
- # for disconn we can check after proc entry is removed
- [ "x${CONN_STATE}" == "x" ] && return 0
- # with AT we can have connect request timeout ~ reconnect timeout
- # and test can't see real disconnect
- [ "${CONN_STATE}" == "CONNECTING" ] && return 0
- fi
- # disconnect rpc should be wait not more obd_timeout
- [ $i -ge $(($TIMEOUT * 3 / 2)) ] && \
- error "can't put import for $CONN_PROC into ${expected} state" && return 1
+ [ $i -ge $maxtime ] && \
+ error "can't put import for $CONN_PROC into ${expected} state after $i sec, have ${CONN_STATE}" && \
+ return 1
sleep 1
CONN_STATE=$($LCTL get_param -n $CONN_PROC 2>/dev/null | cut -f2)
i=$(($i + 1))
done
- log "$CONN_PROC now in ${CONN_STATE} state"
+ log "$CONN_PROC in ${CONN_STATE} state after $i sec"
return 0
}
+wait_import_state() {
+ local state=$1
+ local params=$2
+ local maxtime=${3:-max_recovery_time}
+ local param
+
+ for param in ${params//,/ }; do
+ _wait_import_state $state $param $maxtime || return
+ done
+}
wait_osc_import_state() {
local facet=$1
local ost_facet=$2
shift
# Add paths to lustre tests for 32 and 64 bit systems.
- local RPATH="$RLUSTRE/tests:/usr/lib/lustre/tests:/usr/lib64/lustre/tests:$PATH"
- do_nodesv $list "PATH=$RPATH sh rpc.sh $@ "
+ local RPATH="PATH=$RLUSTRE/tests:/usr/lib/lustre/tests:/usr/lib64/lustre/tests:$PATH"
+ do_nodesv $list "${RPATH} NAME=${NAME} sh rpc.sh $@ "
}
wait_clients_import_state () {
local list=$1
local facet=$2
local expected=$3
- shift
+ local facets=$facet
+
+ if [ "$FAILURE_MODE" = HARD ]; then
+ facets=$(facets_on_host $(facet_active_host $facet))
+ fi
+
+ for facet in ${facets//,/ }; do
local label=$(convert_facet2label $facet)
local proc_path
case $facet in
mds* ) proc_path="mdc.$(get_clientmdc_proc_path $label).mds_server_uuid" ;;
*) error "unknown facet!" ;;
esac
+ local params=$(expand_list $params $proc_path)
+ done
- if ! do_rpc_nodes $list wait_import_state $expected $proc_path; then
+ if ! do_rpc_nodes $list wait_import_state $expected $params; then
error "import is not in ${expected} state"
return 1
fi
local list=$1
local ts=$(date +%s)
-
- # bug 20237, comment 11
- # It would also be useful to provide the option
- # of writing the file to an NFS directory so it doesn't need to be copied.
- local tmp=$TMP
local docp=true
[ -f $LOGDIR/shared ] && docp=false
local res=0
for ((i=0;i<20;i++)); do
- echo -n "checking..."
+ echo -n "checking $dir..."
res=$(do_check_flavor $dir $flavor)
- if [ $res -eq $expect ]; then
- echo "found $res $flavor connections of $dir, OK"
- return 0
- else
- echo "found $res $flavor connections of $dir, not ready ($expect)"
- return 0
- sleep 4
- fi
+ echo "found $res/$expect $flavor connections"
+ [ $res -eq $expect ] && return 0
+ sleep 4
done
echo "Error checking $flavor of $dir: expect $expect, actual $res"
for rule in `do_facet mgs lctl get_param -n $proc 2>/dev/null | grep ".srpc.flavor."`; do
echo "remove rule: $rule"
spec=`echo $rule | awk -F = '{print $1}'`
- do_facet mgs "$LCTL conf_param $spec="
+ do_facet mgs "$LCTL conf_param -d $spec"
done
fi
done
do_umount
}
+
+run_sgpdd () {
+ local devs=${1//,/ }
+ shift
+ local params=$@
+ local rslt=$TMP/sgpdd_survey
+
+ # sgpdd-survey cleanups ${rslt}.* files
+
+ local cmd="rslt=$rslt $params scsidevs=\"$devs\" $SGPDDSURVEY"
+ echo + $cmd
+ eval $cmd
+ cat ${rslt}.detail
+}
+
+# returns the canonical name for an ldiskfs device
+ldiskfs_canon() {
+ local dev="$1"
+ local facet="$2"
+
+ do_facet $facet "dv=\\\$(lctl get_param -n $dev);
+if foo=\\\$(lvdisplay -c \\\$dv 2>/dev/null); then
+ echo dm-\\\${foo##*:};
+else
+ echo \\\$(basename \\\$dv);
+fi;"
+}