export LST=${LST:-"$LUSTRE/../lnet/utils/lst"}
[ ! -f "$LST" ] && export LST=$(which lst)
export SGPDDSURVEY=${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
}
# 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} 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
# 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
}
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
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 $host"
- local affected=$facet
-
- if [ "$FAILURE_MODE" = HARD ]; then
- affected=$(facets_on_host $host)
- fi
+ local affected=$(affected_facets $facet)
shutdown_facet $facet
fi
# FIXME; has to be changed to mount all facets concurrently
affected=$(exclude_items_from_list $affected mgs)
- for facet in ${affected//,/ }; do
- mount_facet $facet || error "Restart of $facet on node $host failed!"
- done
+ mount_facets $affected
}
obd_name() {
echo -n $DEVPTR
}
+facet_mntpt () {
+ local facet=$1
+ local var=${facet}_MOUNT
+ eval mntpt=${!var:-${MOUNT%/*}/$facet}
+
+ echo -n $mntpt
+}
+
########
## MountConf setup
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 () {
echo $ost
}
+ostuuid_from_index()
+{
+ $LFS osts $2 | awk '/^'$1'/ { print $2 }'
+}
+
remote_node () {
local node=$1
[ "$node" != "$(hostname)" ]
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 () {
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