From 7b5f76efce503cdca836e138332fdbaae4b4bbf4 Mon Sep 17 00:00:00 2001 From: Dmitry Eremin Date: Mon, 16 May 2016 13:03:02 +0300 Subject: [PATCH] LU-937 tests: fix CLIENTONLY mode for KNL testing Use default values if getconf utility is absent. Add missing checks for remote servers availability. Add checks for invalid options for cmp and find utilities. Fix test_32 cleanup routine. Change-Id: Ibaa636c62d202741ad86b6dc1711c6971b34c704 Signed-off-by: Dmitry Eremin Reviewed-on: http://review.whamcloud.com/20312 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Jian Yu Reviewed-by: Emoly Liu Reviewed-by: Bob Glossman Reviewed-by: Oleg Drokin --- lustre/tests/sanity.sh | 66 +++++++++++++++++++--- lustre/tests/test-framework.sh | 123 +++++++++++++++++++++-------------------- 2 files changed, 120 insertions(+), 69 deletions(-) mode change 100644 => 100755 lustre/tests/sanity.sh diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh old mode 100644 new mode 100755 index 820f25a..03fb21f --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -1017,7 +1017,9 @@ test_24u() { # bug12192 run_test 24u "create stripe file" page_size() { - getconf PAGE_SIZE + local size + size=$(getconf PAGE_SIZE 2>/dev/null) + echo -n ${size:-4096} } simple_cleanup_common() { @@ -2022,6 +2024,7 @@ run_test 27C "check full striping across all OSTs" test_27D() { [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return [ -n "$FILESET" ] && skip "SKIP due to FILESET set" && return + remote_mds_nodsh && skip "remote MDS with nodsh" && return local POOL=${POOL:-testpool} local first_ost=0 local last_ost=$(($OSTCOUNT - 1)) @@ -2406,8 +2409,13 @@ test_31p() { run_test 31p "remove of open striped directory" cleanup_test32_mount() { + local rc=0 trap 0 - $UMOUNT $DIR/$tdir/ext2-mountpoint + local loopdev=$(losetup -a | grep $EXT2_DEV | sed -ne 's/:.*$/p') + $UMOUNT $DIR/$tdir/ext2-mountpoint || rc=$? + losetup -d $loopdev || true + rm -rf $DIR/$tdir/ext2-mountpoint + return $rc } test_32a() { @@ -2613,8 +2621,13 @@ test_32p() { run_test 32p "open d32p/symlink->tmp/symlink->lustre-root/$tfile" cleanup_testdir_mount() { + local rc=0 trap 0 - $UMOUNT $DIR/$tdir + local loopdev=$(losetup -a | grep $EXT2_DEV | sed -ne 's/:.*$/p') + $UMOUNT $DIR/$tdir || rc=$? + losetup -d $loopdev || true + rm -rf $DIR/$tdir + return $rc } test_32q() { @@ -2814,6 +2827,7 @@ cleanup_33f() { test_33f() { [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return + remote_mds_nodsh && skip "remote MDS with nodsh" && return mkdir $DIR/$tdir chmod go+rwx $DIR/$tdir @@ -3442,6 +3456,7 @@ test_39m() { run_test 39m "test atime and mtime before 1970" test_39n() { # LU-3832 + remote_mds_nodsh && skip "remote MDS with nodsh" && return local atime_diff=$(do_facet $SINGLEMDS \ lctl get_param -n mdd.*MDT0000*.atime_diff) local atime0 @@ -4030,6 +4045,7 @@ run_test 48e "Access to recreated parent subdir (should return errors)" test_49() { # LU-1030 [ $PARALLEL == "yes" ] && skip "skip parallel run" && return + remote_ost_nodsh && skip "remote OST with nodsh" && return # get ost1 size - lustre-OST0000 ost1_size=$(do_facet ost1 $LFS df | grep ${ost1_svc} | awk '{ print $4 }') @@ -4332,6 +4348,7 @@ find_loop_dev() { } cleanup_54c() { + local rc=0 loopdev="$DIR/loop54c" trap 0 @@ -5326,6 +5343,7 @@ run_test 60d "test printk console message masking" test_60e() { [ $PARALLEL == "yes" ] && skip "skip parallel run" && return + remote_mds_nodsh && skip "remote MDS with nodsh" && return touch $DIR/$tfile #define OBD_FAIL_MDS_LLOG_CREATE_FAILED2 0x15b do_facet mds1 lctl set_param fail_loc=0x15b @@ -5907,8 +5925,8 @@ set_inode_slab_tunables() { test_76() { # Now for bug 20433, added originally in bug 1443 [ $PARALLEL == "yes" ] && skip "skip parallel run" && return - local SLAB_SETTINGS=`get_inode_slab_tunables` - local CPUS=`getconf _NPROCESSORS_ONLN` + local SLAB_SETTINGS=$(get_inode_slab_tunables) + local CPUS=$(getconf _NPROCESSORS_ONLN 2>/dev/null) # we cannot set limit below 1 which means 1 inode in each # per-cpu cache is still allowed set_inode_slab_tunables "1 1 0" @@ -5925,7 +5943,7 @@ test_76() { # Now for bug 20433, added originally in bug 1443 AFTER_INODES=$(num_inodes) echo "after inodes: $AFTER_INODES" local wait=0 - while [[ $((AFTER_INODES-1*CPUS)) -gt $BEFORE_INODES ]]; do + while [[ $((AFTER_INODES-1*${CPUS:-1})) -gt $BEFORE_INODES ]]; do sleep 2 AFTER_INODES=$(num_inodes) wait=$((wait+2)) @@ -7229,6 +7247,7 @@ test_103a() { [ -z "$(which setfacl 2>/dev/null)" ] && skip_env "could not find setfacl" && return $GSS && skip "could not run under gss" && return + remote_mds_nodsh && skip "remote MDS with nodsh" && return gpasswd -a daemon bin # LU-5641 do_facet $SINGLEMDS gpasswd -a daemon bin # LU-5641 @@ -7289,6 +7308,7 @@ test_103a() { run_test 103a "acl test =========================================" test_103b() { + remote_mds_nodsh && skip "remote MDS with nodsh" && return local noacl=false local MDT_DEV=$(mdsdevname ${SINGLEMDS//mds/}) local mountopts=$MDS_MOUNT_OPTS @@ -8148,6 +8168,7 @@ run_test 119d "The DIO path should try to send a new rpc once one is completed" test_120a() { [ $PARALLEL == "yes" ] && skip "skip parallel run" && return + remote_mds_nodsh && skip "remote MDS with nodsh" && return test_mkdir -p $DIR/$tdir [ -z "`lctl get_param -n mdc.*.connect_flags | grep early_lock_cancel`" ] && \ skip "no early lock cancel on server" && return 0 @@ -8179,6 +8200,7 @@ run_test 120a "Early Lock Cancel: mkdir test" test_120b() { [ $PARALLEL == "yes" ] && skip "skip parallel run" && return + remote_mds_nodsh && skip "remote MDS with nodsh" && return test_mkdir $DIR/$tdir [ -z "$(lctl get_param -n mdc.*.connect_flags | grep early_lock_cancel)" ] && \ skip "no early lock cancel on server" && return 0 @@ -8206,6 +8228,7 @@ run_test 120b "Early Lock Cancel: create test" test_120c() { [ $PARALLEL == "yes" ] && skip "skip parallel run" && return + remote_mds_nodsh && skip "remote MDS with nodsh" && return test_mkdir -c1 $DIR/$tdir [ -z "$(lctl get_param -n mdc.*.connect_flags | grep early_lock_cancel)" ] && \ skip "no early lock cancel on server" && return 0 @@ -8236,6 +8259,7 @@ run_test 120c "Early Lock Cancel: link test" test_120d() { [ $PARALLEL == "yes" ] && skip "skip parallel run" && return + remote_mds_nodsh && skip "remote MDS with nodsh" && return test_mkdir -p -c1 $DIR/$tdir [ -z "$(lctl get_param -n mdc.*.connect_flags | grep early_lock_cancel)" ] && \ skip "no early lock cancel on server" && return 0 @@ -8266,6 +8290,7 @@ test_120e() { [ $PARALLEL == "yes" ] && skip "skip parallel run" && return ! $($LCTL get_param -n mdc.*.connect_flags | grep -q early_lock_can) && skip "no early lock cancel on server" && return 0 + remote_mds_nodsh && skip "remote MDS with nodsh" && return local dlmtrace_set=false test_mkdir -p -c1 $DIR/$tdir @@ -8307,6 +8332,7 @@ test_120f() { [ $PARALLEL == "yes" ] && skip "skip parallel run" && return [ -z "`lctl get_param -n mdc.*.connect_flags | grep early_lock_cancel`" ] && \ skip "no early lock cancel on server" && return 0 + remote_mds_nodsh && skip "remote MDS with nodsh" && return test_mkdir -p -c1 $DIR/$tdir lru_resize_disable mdc lru_resize_disable osc @@ -8345,6 +8371,7 @@ test_120g() { [ $PARALLEL == "yes" ] && skip "skip parallel run" && return [ -z "`lctl get_param -n mdc.*.connect_flags | grep early_lock_cancel`" ] && \ skip "no early lock cancel on server" && return 0 + remote_mds_nodsh && skip "remote MDS with nodsh" && return lru_resize_disable mdc lru_resize_disable osc count=10000 @@ -9612,6 +9639,8 @@ test_133f() { run_test 133f "Check for LBUGs/Oopses/unreadable files in /proc" test_133g() { + remote_mds_nodsh && skip "remote MDS with nodsh" && return + remote_ost_nodsh && skip "remote OST with nodsh" && return # Second verifying writability. find $proc_dirs \ -type f \ @@ -9645,6 +9674,7 @@ test_133g() { run_test 133g "Check for Oopses on bad io area writes/reads in /proc" test_134a() { + remote_mds_nodsh && skip "remote MDS with nodsh" && return [[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.54) ]] && skip "Need MDS version at least 2.7.54" && return @@ -9680,6 +9710,7 @@ test_134a() { run_test 134a "Server reclaims locks when reaching lock_reclaim_threshold" test_134b() { + remote_mds_nodsh && skip "remote MDS with nodsh" && return [[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.7.54) ]] && skip "Need MDS version at least 2.7.54" && return @@ -9721,9 +9752,9 @@ run_test 134b "Server rejects lock request when reaching lock_limit_mb" test_140() { #bug-17379 [ $PARALLEL == "yes" ] && skip "skip parallel run" && return - test_mkdir -p $DIR/$tdir || error "Creating dir $DIR/$tdir" - cd $DIR/$tdir || error "Changing to $DIR/$tdir" - cp /usr/bin/stat . || error "Copying stat to $DIR/$tdir" + test_mkdir -p $DIR/$tdir || error "Creating dir $DIR/$tdir" + cd $DIR/$tdir || error "Changing to $DIR/$tdir" + cp $(which stat) . || error "Copying stat to $DIR/$tdir" # VFS limits max symlink depth to 5(4KSTACK) or 7(8KSTACK) or 8 # For kernel > 3.5, bellow only tests consecutive symlink (MAX 40) @@ -10170,6 +10201,7 @@ test_154c() { run_test 154c "lfs path2fid and fid2path multiple arguments" test_154d() { + remote_mds_nodsh && skip "remote MDS with nodsh" && return [[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.5.53) ]] && skip "Need MDS version at least 2.5.53" && return @@ -11459,6 +11491,8 @@ test_184b() { run_test 184b "Forbidden layout swap (will generate errors)" test_184c() { + local cmpn_arg=$(cmp -n 2>&1 | grep "invalid option") + [ -n "$cmpn_arg" ] && skip_env "cmp does not support -n" && return check_swap_layouts_support && return 0 local dir0=$DIR/$tdir/$testnum @@ -12511,6 +12545,7 @@ run_test 224b "Don't panic on bulk IO failure" test_224c() { # LU-6441 [ $PARALLEL == "yes" ] && skip "skip parallel run" && return + remote_mds_nodsh && skip "remote MDS with nodsh" && return local pages_per_rpc=$($LCTL get_param \ osc.*.max_pages_per_rpc) local at_max=$($LCTL get_param -n at_max) @@ -13498,6 +13533,7 @@ test_239() { run_test 239 "osp_sync test" test_239a() { #LU-5297 + remote_mds_nodsh && skip "remote MDS with nodsh" && return touch $DIR/$tfile #define OBD_FAIL_OSP_CHECK_INVALID_REC 0x2100 do_facet $SINGLEMDS $LCTL set_param fail_loc=0x2100 @@ -13507,6 +13543,7 @@ test_239a() { #LU-5297 run_test 239a "process invalid osp sync record correctly" test_239b() { #LU-5297 + remote_mds_nodsh && skip "remote MDS with nodsh" && return touch $DIR/$tfile1 #define OBD_FAIL_OSP_CHECK_ENOMEM 0x2101 do_facet $SINGLEMDS $LCTL set_param fail_loc=0x2101 @@ -13521,6 +13558,7 @@ run_test 239b "process osp sync record with ENOMEM error correctly" test_240() { [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return + remote_mds_nodsh && skip "remote MDS with nodsh" && return mkdir -p $DIR/$tdir @@ -13575,6 +13613,7 @@ test_241b() { run_test 241b "dio vs dio" test_242() { + remote_mds_nodsh && skip "remote MDS with nodsh" && return mkdir -p $DIR/$tdir touch $DIR/$tdir/$tfile @@ -13630,6 +13669,7 @@ test_245() { run_test 245 "check mdc connection flag/data: multiple modify RPCs" test_246() { # LU-7371 + remote_ost_nodsh && skip "remote OST with nodsh" && return [ $(lustre_version_code ost1) -lt $(version_code 2.7.62) ] && skip "Need OST version >= 2.7.62" && return 0 do_facet ost1 $LCTL set_param fail_val=4095 @@ -13835,6 +13875,8 @@ test_252() { local num local gen + remote_mds_nodsh && skip "remote MDS with nodsh" && return + remote_ost_nodsh && skip "remote OST with nodsh" && return if [ "$(facet_fstype ost1)" != "ldiskfs" -o \ "$(facet_fstype mds1)" != "ldiskfs" ]; then skip "can only run lr_reader on ldiskfs target" @@ -14598,6 +14640,7 @@ run_test 300o "unlink big sub stripe(> 65000 subdirs)" test_300p() { [ $PARALLEL == "yes" ] && skip "skip parallel run" && return [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return + remote_mds_nodsh && skip "remote MDS with nodsh" && return mkdir -p $DIR/$tdir @@ -14817,6 +14860,9 @@ test_400b() { # LU-1606, LU-5011 run_test 400b "packaged headers can be compiled" test_401a() { #LU-7437 + local printf_arg=$(find -printf 2>&1 | grep "unrecognized:") + [ -n "$printf_arg" ] && skip_env "find does not support -printf" && + return #count the number of parameters by "list_param -R" local params=$($LCTL list_param -R '*' 2>/dev/null | wc -l) #count the number of parameters by listing proc files @@ -14906,6 +14952,7 @@ test_401d() { run_test 401d "Verify 'lctl set_param' accepts values containing '='" test_402() { + remote_mds_nodsh && skip "remote MDS with nodsh" && return $LFS setdirstripe -i 0 $DIR/$tdir || error "setdirstripe -i 0 failed" #define OBD_FAIL_MDS_FLD_LOOKUP 0x15c do_facet mds1 "lctl set_param fail_loc=0x8000015c" @@ -14944,6 +14991,7 @@ test_403() { run_test 403 "i_nlink should not drop to zero due to aliasing" test_404() { # LU-6601 + remote_mds_nodsh && skip "remote MDS with nodsh" && return local mosps=$(do_facet $SINGLEMDS $LCTL dl | awk '/osp .*-osc-MDT/ { print $4}') diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index 8e4ff45..12ec006 100755 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -1149,7 +1149,7 @@ set_debug_size () { if [ -f /sys/devices/system/cpu/possible ]; then local cpus=$(($(cut -d "-" -f 2 /sys/devices/system/cpu/possible)+1)) else - local cpus=$(getconf _NPROCESSORS_CONF) + local cpus=$(getconf _NPROCESSORS_CONF 2>/dev/null) fi # bug 19944, adjust size to be -gt num_possible_cpus() @@ -1564,7 +1564,7 @@ zconf_umount() { local client=$1 local mnt=$2 local force - local busy + local busy local need_kill [ "$3" ] && force=-f @@ -1605,13 +1605,13 @@ if [ \\\$running -ne \\\$mpts ]; then echo \\\$(hostname) env are INSANE!; exit 1; fi" - [ $? -eq 0 ] || rc=1 + [ $? -eq 0 ] || rc=1 done return $rc } sanity_mount_check_servers () { - [ "$CLIENTONLY" ] && + [ -n "$CLIENTONLY" ] && { echo "CLIENTONLY mode, skip mount_check_servers"; return 0; } || true echo Checking servers environments @@ -1733,7 +1733,7 @@ shutdown_node_hard () { 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; } + { echo "$host still pingable after power down! attempts=$attempts" && return 1; } done } @@ -3341,7 +3341,8 @@ stopall() { zconf_umount_clients $clients $MOUNT "$*" || true [ -n "$MOUNT2" ] && zconf_umount_clients $clients $MOUNT2 "$*" || true - [ "$CLIENTONLY" ] && return + [ -n "$CLIENTONLY" ] && return + # The add fn does rm ${facet}active file, this would be enough # if we use do_facet only after the facet added, but # currently we use do_facet mds in local.sh @@ -3552,7 +3553,7 @@ formatall() { # We need ldiskfs here, may as well load them all load_modules - [ "$CLIENTONLY" ] && return + [ -n "$CLIENTONLY" ] && return echo Formatting mgs, mds, osts if ! combined_mgs_mds ; then format_mgs @@ -3642,21 +3643,19 @@ writeconf_all () { } setupall() { - nfs_client_mode && return + nfs_client_mode && return cifs_client_mode && return - sanity_mount_check || - error "environments are insane!" + sanity_mount_check || error "environments are insane!" - load_modules + load_modules - if [ -z "$CLIENTONLY" ]; then - echo Setup mgs, mdt, osts - echo $WRITECONF | grep -q "writeconf" && \ - writeconf_all - if ! combined_mgs_mds ; then + if [ -z "$CLIENTONLY" ]; then + echo Setup mgs, mdt, osts + echo $WRITECONF | grep -q "writeconf" && writeconf_all + if ! combined_mgs_mds ; then start mgs $(mgsdevname) $MGS_MOUNT_OPTS - fi + fi for num in `seq $MDSCOUNT`; do DEVNAME=$(mdsdevname $num) @@ -3725,7 +3724,7 @@ mounted_lustre_filesystems() { } init_facet_vars () { - [ "$CLIENTONLY" ] && return 0 + [ -n "$CLIENTONLY" ] && return 0 local facet=$1 shift local device=$1 @@ -3855,9 +3854,12 @@ set_conf_param_and_check() { } init_param_vars () { - remote_mds_nodsh || - TIMEOUT=$(do_facet $SINGLEMDS "lctl get_param -n timeout") + TIMEOUT=$(lctl get_param -n timeout) + TIMEOUT=${TIMEOUT:-20} + remote_mds_nodsh && log "Using TIMEOUT=$TIMEOUT" && return 0 + + TIMEOUT=$(do_facet $SINGLEMDS "lctl get_param -n timeout") log "Using TIMEOUT=$TIMEOUT" osc_ensure_active $SINGLEMDS $TIMEOUT @@ -3918,14 +3920,14 @@ check_config_client () { local mntpt=$1 local mounted=$(mount | grep " $mntpt ") - if [ "$CLIENTONLY" ]; then + if [ -n "$CLIENTONLY" ]; then # bug 18021 # CLIENTONLY should not depend on *_HOST settings local mgc=$($LCTL device_list | awk '/MGC/ {print $4}') # in theory someone could create a new, # client-only config file that assumed lustre was already # configured and didn't set the MGSNID. If MGSNID is not set, - # then we should use the mgs nid currently being used + # then we should use the mgs nid currently being used # as the default value. bug 18021 [[ x$MGSNID = x ]] && MGSNID=${mgc//MGC/} @@ -3940,9 +3942,9 @@ check_config_client () { return 0 fi - local myMGS_host=$mgs_HOST + local myMGS_host=$mgs_HOST if [ "$NETTYPE" = "ptl" ]; then - myMGS_host=$(h2ptl $mgs_HOST | sed -e s/@ptl//) + myMGS_host=$(h2ptl $mgs_HOST | sed -e s/@ptl//) fi echo Checking config lustre mounted on $mntpt @@ -4045,7 +4047,7 @@ check_and_setup_lustre() { restore_mount $MOUNT2 export I_MOUNTED2=yes fi - fi + fi # 5. # MOUNT is mounted MOUNT2 is not mounted @@ -4066,7 +4068,7 @@ check_and_setup_lustre() { set_default_debug_nodes $(comma_list $(nodes_list)) fi - if [ $(lower $OSD_TRACK_DECLARES_LBUG) == 'yes' ] ; then + if [ -z "$CLIENTONLY" -a $(lower $OSD_TRACK_DECLARES_LBUG) == 'yes' ]; then local facets="" [ "$(facet_fstype ost1)" = "ldiskfs" ] && facets="$(get_facets OST)" @@ -4086,12 +4088,14 @@ check_and_setup_lustre() { set_flavor_all $SEC fi - #Enable remote MDT create for testing - for num in $(seq $MDSCOUNT); do - do_facet mds$num \ - lctl set_param -n mdt.${FSNAME}*.enable_remote_dir=1 \ - 2>/dev/null - done + if [ -z "$CLIENTONLY" ]; then + # Enable remote MDT create for testing + for num in $(seq $MDSCOUNT); do + do_facet mds$num \ + lctl set_param -n mdt.${FSNAME}*.enable_remote_dir=1 \ + 2>/dev/null + done + fi if [ "$ONLY" == "setup" ]; then exit 0 @@ -5011,9 +5015,9 @@ reset_fail_loc () { # -# Log a message (on all nodes) padded with "=" before and after. +# Log a message (on all nodes) padded with "=" before and after. # Also appends a timestamp and prepends the testsuite name. -# +# EQUALS="====================================================================================================" banner() { @@ -5264,15 +5268,15 @@ remote_mds () remote_mds_nodsh() { - [ "$CLIENTONLY" ] && return 0 || true - remote_mds && [ "$PDSH" = "no_dsh" -o -z "$PDSH" -o -z "$mds_HOST" ] + [ -n "$CLIENTONLY" ] && return 0 || true + remote_mds && [ "$PDSH" = "no_dsh" -o -z "$PDSH" -o -z "$mds_HOST" ] } require_dsh_mds() { - remote_mds_nodsh && echo "SKIP: $TESTSUITE: remote MDS with nodsh" && \ - MSKIPPED=1 && return 1 - return 0 + remote_mds_nodsh && echo "SKIP: $TESTSUITE: remote MDS with nodsh" && + MSKIPPED=1 && return 1 + return 0 } remote_ost () @@ -5286,8 +5290,8 @@ remote_ost () remote_ost_nodsh() { - [ "$CLIENTONLY" ] && return 0 || true - remote_ost && [ "$PDSH" = "no_dsh" -o -z "$PDSH" -o -z "$ost_HOST" ] + [ -n "$CLIENTONLY" ] && return 0 || true + remote_ost && [ "$PDSH" = "no_dsh" -o -z "$PDSH" -o -z "$ost_HOST" ] } require_dsh_ost() @@ -5299,10 +5303,10 @@ require_dsh_ost() remote_mgs_nodsh() { - [ "$CLIENTONLY" ] && return 0 || true - local MGS - MGS=$(facet_host mgs) - remote_node $MGS && [ "$PDSH" = "no_dsh" -o -z "$PDSH" -o -z "$ost_HOST" ] + [ -n "$CLIENTONLY" ] && return 0 || true + local MGS + MGS=$(facet_host mgs) + remote_node $MGS && [ "$PDSH" = "no_dsh" -o -z "$PDSH" -o -z "$ost_HOST" ] } local_mode () @@ -5463,14 +5467,14 @@ get_random_entry () { rnodes=${rnodes//,/ } local -a nodes=($rnodes) - local num=${#nodes[@]} + local num=${#nodes[@]} local i=$((RANDOM * num * 2 / 65536)) echo ${nodes[i]} } client_only () { - [ "$CLIENTONLY" ] || [ "$CLIENTMODSONLY" = yes ] + [ -n "$CLIENTONLY" ] || [ "x$CLIENTMODSONLY" = "xyes" ] } check_versions () { @@ -6273,7 +6277,7 @@ gather_logs () { suffix="$ts.log" echo "Dumping lctl log to ${prefix}.*.${suffix}" - if [ "$CLIENTONLY" -o "$PDSH" == "no_dsh" ]; then + if [ -n "$CLIENTONLY" -o "$PDSH" == "no_dsh" ]; then echo "Dumping logs only on local client." $LCTL dk > ${prefix}.debug_log.$(hostname -s).${suffix} dmesg > ${prefix}.dmesg.$(hostname -s).${suffix} @@ -6910,11 +6914,10 @@ get_obd_size() { # get_page_size() { local facet=$1 - local size + local size=$(getconf PAGE_SIZE 2>/dev/null) - size=$(do_facet $facet getconf PAGE_SIZE) - [[ ${PIPESTATUS[0]} = 0 && -n "$size" ]] || size=4096 - echo -n $size + [ -z "$CLIENTONLY" ] && size=$(do_facet $facet getconf PAGE_SIZE) + echo -n ${size:-4096} } # @@ -6925,20 +6928,20 @@ get_block_count() { local device=$2 local count - count=$(do_facet $facet "$DUMPE2FS -h $device 2>&1" | + [ -z "$CLIENTONLY" ] && count=$(do_facet $facet "$DUMPE2FS -h $device 2>&1" | awk '/^Block count:/ {print $3}') - echo -n $count + echo -n ${count:-0} } # Get the block size of the filesystem. get_block_size() { - local facet=$1 - local device=$2 - local size + local facet=$1 + local device=$2 + local size - size=$(do_facet $facet "$DUMPE2FS -h $device 2>&1" | - awk '/^Block size:/ {print $3}') - echo $size + [ -z "$CLIENTONLY" ] && size=$(do_facet $facet "$DUMPE2FS -h $device 2>&1" | + awk '/^Block size:/ {print $3}') + echo -n ${size:-0} } # Check whether the "large_xattr" feature is enabled or not. -- 1.8.3.1