local rc=0
for mnt in $mnts ; do
- do_nodes $nodes "set -x; running=\\\$(grep -c $mnt' ' /proc/mounts);
+ do_nodes $nodes "running=\\\$(grep -c $mnt' ' /proc/mounts);
mpts=\\\$(mount | grep -w -c $mnt);
if [ \\\$running -ne \\\$mpts ]; then
echo \\\$(hostname) env are INSANE!;
echo "Starting client $clients: $OPTIONS $device $mnt"
- do_nodes $clients "set -x;
+ do_nodes $clients "
running=\\\$(mount | grep -c $mnt' ');
rc=0;
if [ \\\$running -eq 0 ] ; then
[ "$3" ] && force=-f
echo "Stopping clients: $clients $mnt (opts:$force)"
- do_nodes $clients "set -x; running=\\\$(grep -c $mnt' ' /proc/mounts);
+ do_nodes $clients "running=\\\$(grep -c $mnt' ' /proc/mounts);
if [ \\\$running -ne 0 ] ; then
echo Stopping client \\\$(hostname) client $mnt opts:$force;
lsof -t $mnt || need_kill=no;
shift
local progs=$@
- do_nodes $clients "set -x ; PATH=:$PATH; status=true;
+ do_nodes $clients "PATH=:$PATH; status=true;
for prog in $progs; do
if ! [ \\\"\\\$(which \\\$prog)\\\" -o \\\"\\\${!prog}\\\" ]; then
echo \\\$prog missing on \\\$(hostname);
}
do_node() {
- HOST=$1
+ local verbose=false
+ # do not stripe off hostname if verbose, bug 19215
+ if [ x$1 = x--verbose ]; then
+ shift
+ verbose=true
+ fi
+
+ local HOST=$1
shift
local myPDSH=$PDSH
if [ "$HOST" = "$HOSTNAME" ]; then
[ -n "$($myPDSH $HOST cat $command_status)" ] && return 1 || true
return 0
fi
- $myPDSH $HOST "(PATH=\$PATH:$RLUSTRE/utils:$RLUSTRE/tests:/sbin:/usr/sbin; cd $RPWD; sh -c \"$@\")" | sed "s/^${HOST}: //"
+
+ if $verbose ; then
+ $myPDSH $HOST "(PATH=\$PATH:$RLUSTRE/utils:$RLUSTRE/tests:/sbin:/usr/sbin; cd $RPWD; sh -c \"$@\")"
+ else
+ $myPDSH $HOST "(PATH=\$PATH:$RLUSTRE/utils:$RLUSTRE/tests:/sbin:/usr/sbin; cd $RPWD; sh -c \"$@\")" | sed "s/^${HOST}: //"
+ fi
return ${PIPESTATUS[0]}
}
}
do_nodes() {
+ local verbose=false
+ # do not stripe off hostname if verbose, bug 19215
+ if [ x$1 = x--verbose ]; then
+ shift
+ verbose=true
+ fi
+
local rnodes=$1
shift
if $(single_local_node $rnodes); then
+ $verbose && echo -n $rnodes:' ' || true
do_node $rnodes $@
return $?
fi
$myPDSH $rnodes $LCTL mark "$@" > /dev/null 2>&1 || :
fi
- $myPDSH $rnodes "(PATH=\$PATH:$RLUSTRE/utils:$RLUSTRE/tests:/sbin:/usr/sbin; cd $RPWD; sh -c \"$@\")" | sed -re "s/\w+:\s//g"
+ if $verbose ; then
+ $myPDSH $rnodes "(PATH=\$PATH:$RLUSTRE/utils:$RLUSTRE/tests:/sbin:/usr/sbin; cd $RPWD; sh -c \"$@\")"
+ else
+ $myPDSH $rnodes "(PATH=\$PATH:$RLUSTRE/utils:$RLUSTRE/tests:/sbin:/usr/sbin; cd $RPWD; sh -c \"$@\")" | sed -re "s/\w+:\s//g"
+ fi
return ${PIPESTATUS[0]}
}
}
cleanupall() {
+ nfs_client_mode && return
+
stopall $*
unload_modules
cleanup_gss
}
setupall() {
+ nfs_client_mode && return
+
sanity_mount_check ||
error "environments are insane!"
fi
}
+nfs_client_mode () {
+ if [ "$NFSCLIENT" ]; then
+ echo "NFSCLIENT mode: setup, cleanup, check config skipped"
+ local clients=$CLIENTS
+ [ -z $clients ] && clients=$(hostname)
+
+ # FIXME: remove hostname when 19215 fixed
+ do_nodes $clients "echo \\\$(hostname); grep ' '$MOUNT' ' /proc/mounts"
+ declare -a nfsexport=(`grep ' '$MOUNT' ' /proc/mounts | awk '{print $1}' | awk -F: '{print $1 " " $2}'`)
+ do_nodes ${nfsexport[0]} "echo \\\$(hostname); df -T ${nfsexport[1]}"
+ return
+ fi
+ return 1
+}
+
check_config () {
+ nfs_client_mode && return
+
local mntpt=$1
local mounted=$(mount | grep " $mntpt ")
}
check_and_setup_lustre() {
+ nfs_client_mode && return
+
local MOUNTED=$(mounted_lustre_filesystems)
if [ -z "$MOUNTED" ] || ! $(echo $MOUNTED | grep -w -q $MOUNT); then
[ "$REFORMAT" ] && formatall
check_config $MOUNT
init_facets_vars
init_param_vars
+
+ do_nodes $(comma_list $(nodes_list)) "lctl set_param debug=\\\"$PTLDEBUG\\\";
+ lctl set_param subsystem_debug=\\\"${SUBSYSTEM# }\\\";
+ lctl set_param debug_mb=${DEBUG_SIZE};
+ sync"
fi
if [ "$ONLY" == "setup" ]; then
exit 0
# generate a stream of formatted strings (<node> <param name>=<param value>)
save_lustre_params() {
local s
- do_node $1 "lctl get_param $2" | while read s; do echo "$1 $s"; done
+ do_nodes --verbose $1 "lctl get_param $2 | while read s; do echo \\\$s; done"
}
# restore lustre parameters from input stream, produces by save_lustre_params
local name
local val
while IFS=" =" read node name val; do
- do_node $node "lctl set_param -n $name $val"
+ do_node ${node//:/} "lctl set_param -n $name $val"
done
}