fi
}
+# Mount the file system on the MGS
+mount_mgs_client() {
+ do_facet mgs "mkdir -p $MOUNT"
+ zconf_mount $mgs_HOST $MOUNT $MOUNT_OPTS ||
+ error "unable to mount $MOUNT on MGS"
+}
+
+# Unmount the file system on the MGS
+umount_mgs_client() {
+ zconf_umount $mgs_HOST $MOUNT
+ do_facet mgs "rm -rf $MOUNT"
+}
+
# nodes is comma list
sanity_mount_check_nodes () {
local nodes=$1
[ "$arg1" = "server_only" ] && return
fi
mount_client $MOUNT
- [ -n "$CLIENTS" ] && zconf_mount_clients $CLIENTS $MOUNT
+ if [ -n "$CLIENTS" ]; then
+ zconf_mount_clients $CLIENTS $MOUNT
+ fi
clients_up
if [ "$MOUNT_2" ]; then
mount_client $MOUNT2
- [ -n "$CLIENTS" ] && zconf_mount_clients $CLIENTS $MOUNT2
+ if [ -n "$CLIENTS" ]; then
+ zconf_mount_clients $CLIENTS $MOUNT2
+ fi
fi
}
}
check_network() {
- local host=$1
- local max=$2
- local sleep=${3:-5}
+ 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
+ [ "$host" = "$HOSTNAME" ] && return 0
+
+ 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
+ echo "$(date +'%H:%M:%S (%s)') network interface is UP"
}
no_dsh() {
# Test interface
##################################
+# usage: stack_trap arg sigspec
+#
+# stack_trap() behaves like bash's built-in trap, except that it "stacks" the
+# command ``arg`` on top of previously defined commands for ``sigspec`` instead
+# of overwriting them.
+# stacked traps are executed in reverse order of their registration
+#
+# arg and sigspec have the same meaning as in man (1) trap
+stack_trap()
+{
+ local arg="$1"
+ local sigspec="$2"
+
+ local cmd="$(trap -p $sigspec)"
+
+ cmd="${cmd#trap -- \'}"
+ cmd="${cmd%\'*}"
+ [ -n "$cmd" ] && cmd="; $cmd"
+ cmd="${arg}$cmd"
+
+ trap "$cmd" $sigspec
+}
+
error_noexit() {
report_error "$@"
}
local mdt_label=$(convert_facet2label $mds_facet)
local mdt_index=$(echo $mdt_label | sed -e 's/^.*-//')
- if [ $(lustre_version_code $mds_facet) -le $(version_code 1.8.0) ] ||
- mds_on_old_device $mds_facet; then
- echo "${ost_label}-osc"
- elif [[ $ost_label = *OST* ]]; then
+ if [[ $ost_label = *OST* ]]; then
echo "${ost_label}-osc-${mdt_index}"
else
echo "${ost_label}-osp-${mdt_index}"
local param=$($LFS getstripe -d $1 | parse_layout_param)
echo "$param"
}
+
+lfsck_verify_pfid()
+{
+ local f
+ local rc=0
+
+ # Cancel locks before setting lfsck_verify_pfid so that errors are more
+ # controllable
+ cancel_lru_locks mdc
+ cancel_lru_locks osc
+
+ # make sure PFID is set correctly for files
+ do_nodes $(comma_list $(osts_nodes)) \
+ "$LCTL set_param -n obdfilter.${FSNAME}-OST*.lfsck_verify_pfid=1"
+
+ for f in "$@"; do
+ cat $f &> /dev/nullA ||
+ { rc=$?; echo "verify $f failed"; break; }
+ done
+
+ do_nodes $(comma_list $(osts_nodes)) \
+ "$LCTL set_param -n obdfilter.${FSNAME}-OST*.lfsck_verify_pfid=0"
+ return $rc
+}
+
+# check that clients "oscs" was evicted after "before"
+check_clients_evicted() {
+ local before=$1
+ shift
+ local oscs=${@}
+ local osc
+ local rc=0
+
+ for osc in $oscs; do
+ ((rc++))
+ echo "Check state for $osc"
+ local evicted=$(do_facet client $LCTL get_param osc.$osc.state |
+ tail -n 3 | awk -F"[ [,]" \
+ '/EVICTED ]$/ { if (mx<$5) {mx=$5;} } END { print mx }')
+ if (($? == 0)) && (($evicted > $before)); then
+ echo "$osc is evicted at $evicted"
+ ((rc--))
+ fi
+ done
+
+ [ $rc -eq 0 ] || error "client not evicted from OST"
+}
+
+# check that clients OSCS current_state is FULL
+check_clients_full() {
+ local timeout=$1
+ shift
+ local oscs=${@}
+
+ for osc in $oscs; do
+ wait_update_facet client \
+ "lctl get_param -n osc.$osc.state |
+ grep 'current_state: FULL'" \
+ "current_state: FULL" $timeout
+ [ $? -eq 0 ] || error "$osc state is not FULL"
+ done
+}