From e0063a5db5289d1433476112410e942e036b76a4 Mon Sep 17 00:00:00 2001 From: Alex Zhuravlev Date: Wed, 3 Oct 2012 23:30:58 +0400 Subject: [PATCH] LU-1175 tests: use ofd by default instead of obdfilter Set USE_OFD=yes by default in order to start testing the ofd module in preference to the obdfilter module. Force LOAD_MODULES_REMOTE to be set to avoid obdfilter being loaded by modprobe remotely on mount. There was a bug in comma_list() appending a space to the list of nodes, which caused do_rpc_nodes() to be unhappy when a nearly-empty list of nodes was being passed by callers. Rework this function, and clean up other callers to just pass the nodes and let do_rpc_nodes() detect this case and skip any remote execution. Signed-off-by: Alex Zhuravlev Signed-off-by: Andreas Dilger Change-Id: I896c9c9b7216c418b635e893202810333d8ef871 Reviewed-on: http://review.whamcloud.com/4171 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Mike Pershin Reviewed-by: Alex Zhuravlev --- lustre/tests/cfg/local.sh | 4 +- lustre/tests/test-framework.sh | 136 +++++++++++++++++++++-------------------- 2 files changed, 73 insertions(+), 67 deletions(-) diff --git a/lustre/tests/cfg/local.sh b/lustre/tests/cfg/local.sh index 56c9c83..3f056d7 100644 --- a/lustre/tests/cfg/local.sh +++ b/lustre/tests/cfg/local.sh @@ -81,8 +81,8 @@ ZFS_MKFS_OPTS=${ZFS_MKFS_OPTS:-} # LOAD_MODULES_REMOTE is true or b) modprobe(8) is configured to # blacklist the undesired (and aliased the other, if necessary). # -USE_OFD=${USE_OFD:-no} -LOAD_MODULES_REMOTE=${LOAD_MODULES_REMOTE:-false} +USE_OFD=${USE_OFD:-yes} +LOAD_MODULES_REMOTE=${LOAD_MODULES_REMOTE:-true} STRIPE_BYTES=${STRIPE_BYTES:-1048576} STRIPES_PER_OBJ=${STRIPES_PER_OBJ:-0} diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index fa3dadb..89000f3 100644 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -282,6 +282,9 @@ init_test_env() { IDENTITY_UPCALL=false ;; esac + USE_OFD=${USE_OFD:-yes} + [ "$USE_OFD" = "yes" ] && LOAD_MODULES_REMOTE=true + export LOAD_MODULES_REMOTE=${LOAD_MODULES_REMOTE:-false} # Paths on remote nodes, if different @@ -551,10 +554,12 @@ load_modules () { # bug 19124 # load modules on remote nodes optionally # lustre-tests have to be installed on these nodes - if $LOAD_MODULES_REMOTE ; then + if $LOAD_MODULES_REMOTE; then local list=$(comma_list $(remote_nodes_list)) - echo loading modules on $list - do_rpc_nodes $list load_modules_local + if [ -n "$list" ]; then + echo "loading modules on: '$list'" + do_rpc_nodes "$list" load_modules_local + fi fi } @@ -576,12 +581,12 @@ unload_modules() { $LUSTRE_RMMOD ldiskfs || return 2 - if $LOAD_MODULES_REMOTE ; then + if $LOAD_MODULES_REMOTE; then local list=$(comma_list $(remote_nodes_list)) - if [ ! -z $list ]; then - echo unloading modules on $list - do_rpc_nodes $list $LUSTRE_RMMOD ldiskfs - do_rpc_nodes $list check_mem_leak + if [ -n "$list" ]; then + echo "unloading modules on: '$list'" + do_rpc_nodes "$list" $LUSTRE_RMMOD ldiskfs + do_rpc_nodes "$list" check_mem_leak fi fi @@ -859,15 +864,15 @@ set_default_debug () { } set_default_debug_nodes () { - local nodes=$1 + local nodes="$1" - if [[ ,$nodes, = *,$HOSTNAME,* ]]; then - nodes=$(exclude_items_from_list "$nodes" "$HOSTNAME") - set_default_debug - fi + if [[ ,$nodes, = *,$HOSTNAME,* ]]; then + nodes=$(exclude_items_from_list "$nodes" "$HOSTNAME") + set_default_debug + fi - [[ -n $nodes ]] && do_rpc_nodes $nodes set_default_debug \ - \\\"$PTLDEBUG\\\" \\\"$SUBSYSTEM\\\" $DEBUG_SIZE || true + do_rpc_nodes "$nodes" set_default_debug \ + \\\"$PTLDEBUG\\\" \\\"$SUBSYSTEM\\\" $DEBUG_SIZE || true } set_default_debug_facet () { @@ -1519,10 +1524,10 @@ _check_progs_installed () { } check_progs_installed () { - local nodes=$1 - shift + local nodes=$1 + shift - do_rpc_nodes $nodes _check_progs_installed $@ + do_rpc_nodes "$nodes" _check_progs_installed $@ } # recovery-scale functions @@ -1889,14 +1894,14 @@ wait_recovery_complete () { 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" + # 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 + local host=$(facet_active_host $facet) + do_rpc_nodes "$host" _wait_recovery_complete $param $MAX + done } wait_mds_ost_sync () { @@ -3223,15 +3228,14 @@ check_config_client () { } check_config_clients () { - local clients=${CLIENTS:-$HOSTNAME} - local mntpt=$1 + local clients=${CLIENTS:-$HOSTNAME} + local mntpt=$1 - nfs_client_mode && return + nfs_client_mode && return - do_rpc_nodes $clients check_config_client $mntpt + do_rpc_nodes "$clients" check_config_client $mntpt - sanity_mount_check || - error "environments are insane!" + sanity_mount_check || error "environments are insane!" } check_timeout () { @@ -3413,12 +3417,12 @@ run_e2fsck() { # verify a directory is shared among nodes. check_shared_dir() { - local dir=$1 + local dir=$1 - [ -z "$dir" ] && return 1 - do_rpc_nodes $(comma_list $(nodes_list)) check_logdir $dir - check_write_access $dir || return 1 - return 0 + [ -z "$dir" ] && return 1 + do_rpc_nodes "$(comma_list $(nodes_list))" check_logdir $dir + check_write_access $dir || return 1 + return 0 } # Run e2fsck on MDT and OST(s) to generate databases used for lfsck. @@ -3542,10 +3546,12 @@ no_dsh() { eval $@ } +# Convert a space-delimited list to a comma-delimited list. If the input is +# only whitespace, ensure the output is empty (i.e. "") so [ -n $list ] works comma_list() { - # the sed converts spaces to commas, but leaves the last space - # alone, so the line doesn't end with a comma. - echo "$*" | tr -s " " "\n" | sort -b -u | tr "\n" " " | sed 's/ \([^$]\)/,\1/g' + # echo is used to convert newlines to spaces, since it doesn't + # introduce a trailing space as using "tr '\n' ' '" does + echo $(tr -s " " "\n" <<< $* | sort -b -u) | tr ' ' ',' } list_member () { @@ -4377,9 +4383,7 @@ nodes_list () { } remote_nodes_list () { - local rnodes=$(nodes_list) - rnodes=$(echo " $rnodes " | sed -re "s/\s+$HOSTNAME\s+/ /g") - echo $rnodes + echo $(nodes_list) | sed -re "s/\<$HOSTNAME\>//g" } init_clients_lists () { @@ -4698,15 +4702,15 @@ restore_lustre_params() { } check_catastrophe() { - local rnodes=${1:-$(comma_list $(remote_nodes_list))} - local C=$CATASTROPHE - [ -f $C ] && [ $(cat $C) -ne 0 ] && return 1 + local rnodes=${1:-$(comma_list $(remote_nodes_list))} + local C=$CATASTROPHE + [ -f $C ] && [ $(cat $C) -ne 0 ] && return 1 + + [ -z "$rnodes" ] && return 0 - if [ $rnodes ]; then - do_nodes $rnodes "rc=\\\$([ -f $C ] && echo \\\$(< $C) || echo 0); -if [ \\\$rc -ne 0 ]; then echo \\\$(hostname): \\\$rc; fi -exit \\\$rc;" - fi + do_nodes "$rnodes" "rc=\\\$([ -f $C ] && echo \\\$(< $C) || echo 0); + if [ \\\$rc -ne 0 ]; then echo \\\$(hostname): \\\$rc; fi + exit \\\$rc;" } # CMD: determine mds index where directory inode presents @@ -4915,13 +4919,13 @@ wait_osc_import_state() { # 2. wait the deadline of client 2nd request local maxtime=$(( 2 * $(request_timeout $facet))) - if ! do_rpc_nodes $(facet_host $facet) \ - _wait_import_state $expected $param $maxtime; then - error "import is not in ${expected} state" - return 1 - fi + if ! do_rpc_nodes "$(facet_host $facet)" \ + _wait_import_state $expected $param $maxtime; then + error "import is not in ${expected} state" + return 1 + fi - return 0 + return 0 } get_clientmdc_proc_path() { @@ -4929,12 +4933,14 @@ get_clientmdc_proc_path() { } do_rpc_nodes () { - local list=$1 - shift + local list=$1 + shift + + [ -z "$list" ] && return 0 - # Add paths to lustre tests for 32 and 64 bit systems. - local RPATH="PATH=$RLUSTRE/tests:/usr/lib/lustre/tests:/usr/lib64/lustre/tests:$PATH" - do_nodesv $list "${RPATH} NAME=${NAME} sh rpc.sh $@ " + # Add paths to lustre tests for 32 and 64 bit systems. + 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 () { @@ -4959,10 +4965,10 @@ wait_clients_import_state () { local params=$(expand_list $params $proc_path) done - if ! do_rpc_nodes $list wait_import_state $expected $params; then - error "import is not in ${expected} state" - return 1 - fi + if ! do_rpc_nodes "$list" wait_import_state $expected $params; then + error "import is not in ${expected} state" + return 1 + fi } oos_full() { -- 1.8.3.1