X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Ftests%2Ftest-framework.sh;h=f9c6f8e6d2563fed733e7ce47c730da2a84777d3;hb=dafd02632c999212f6e574704846195d377f2ee4;hp=384b1fb7f9ff77564850525f20898035ce49a109;hpb=6fa4e9da93c2d827769aaeb4af5283567c634d10;p=fs%2Flustre-release.git diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index 384b1fb..f9c6f8e 100755 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -148,6 +148,23 @@ print_summary () { fi } +# Get information about the Lustre environment. The information collected +# will be used in Lustre tests. +# usage: get_lustre_env +# input: No required or optional arguments +# output: No return values, environment variables are exported + +get_lustre_env() { + + export mds1_FSTYPE=${mds1_FSTYPE:-$(facet_fstype mds1)} + export ost1_FSTYPE=${ost1_FSTYPE:-$(facet_fstype ost1)} + + export MGS_VERSION=$(lustre_version_code mgs) + export MDS1_VERSION=$(lustre_version_code mds1) + export OST1_VERSION=$(lustre_version_code ost1) + export CLIENT_VERSION=$(lustre_version_code client) +} + init_test_env() { export LUSTRE=$(absolute_path $LUSTRE) export TESTSUITE=$(basename $0 .sh) @@ -2331,7 +2348,8 @@ zconf_mount_clients() { fi echo "Starting client $clients: $flags $opts $device $mnt" - if [ -n "$FILESET" -a ! -n "$SKIP_FILESET" ]; then + do_nodes $clients mkdir -p $mnt + if [ -n "$FILESET" -a -z "$SKIP_FILESET" ]; then if $GSS_SK && ($SK_UNIQUE_NM || $SK_S2S); then # Mount with own nodemap key local i=0 @@ -2638,6 +2656,18 @@ start_client_load() { LFS=$LFS \ LCTL=$LCTL \ FSNAME=$FSNAME \ + MPIRUN=$MPIRUN \ + MPIRUN_OPTIONS=\\\"$MPIRUN_OPTIONS\\\" \ + MACHINEFILE_OPTION=\\\"$MACHINEFILE_OPTION\\\" \ + num_clients=$(get_node_count ${CLIENTS//,/ }) \ + ior_THREADS=$ior_THREADS ior_iteration=$ior_iteration \ + ior_blockSize=$ior_blockSize \ + ior_blockUnit=$ior_blockUnit \ + ior_xferSize=$ior_xferSize ior_type=$ior_type \ + ior_DURATION=$ior_DURATION \ + ior_stripe_params=\\\"$ior_stripe_params\\\" \ + ior_custom_params=\\\"$ior_custom_param\\\" \ + mpi_ior_custom_threads=$mpi_ior_custom_threads \ run_${load}.sh" & local ppid=$! log "Started client load: ${load} on $client" @@ -4401,7 +4431,7 @@ formatall() { # (Assumes MDS version is also OSS version) if [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.8.54) ]; then - do_rpc_nodes "$(comma_list $(remote_nodes_list))" set_hostid + do_rpc_nodes "$(comma_list $(all_server_nodes))" set_hostid fi # We need ldiskfs here, may as well load them all @@ -5502,7 +5532,7 @@ at_max_set() { drop_request() { # OBD_FAIL_MDS_ALL_REQUEST_NET RC=0 - do_facet $SINGLEMDS lctl set_param fail_loc=0x123 + do_facet $SINGLEMDS lctl set_param fail_val=0 fail_loc=0x123 do_facet client "$1" || RC=$? do_facet $SINGLEMDS lctl set_param fail_loc=0 return $RC @@ -5587,11 +5617,11 @@ drop_bl_callback() { return $rc } -drop_ldlm_reply() { -#define OBD_FAIL_LDLM_REPLY 0x30c +drop_mdt_ldlm_reply() { +#define OBD_FAIL_MDS_LDLM_REPLY_NET 0x157 RC=0 - local list=$(comma_list $(mdts_nodes) $(osts_nodes)) - do_nodes $list lctl set_param fail_loc=0x30c + local list=$(comma_list $(mdts_nodes)) + do_nodes $list lctl set_param fail_loc=0x157 do_facet client "$@" || RC=$? @@ -5599,11 +5629,11 @@ drop_ldlm_reply() { return $RC } -drop_ldlm_reply_once() { -#define OBD_FAIL_LDLM_REPLY 0x30c +drop_mdt_ldlm_reply_once() { +#define OBD_FAIL_MDS_LDLM_REPLY_NET 0x157 RC=0 - local list=$(comma_list $(mdts_nodes) $(osts_nodes)) - do_nodes $list lctl set_param fail_loc=0x8000030c + local list=$(comma_list $(mdts_nodes)) + do_nodes $list lctl set_param fail_loc=0x80000157 do_facet client "$@" || RC=$? @@ -5842,6 +5872,12 @@ error_not_in_vm() { fi } +# +# Function: skip_env() +# Purpose: to skip a test during developer testing because some tool +# is missing, but fail the test in release testing because the test +# environment is not configured properly". +# skip_env () { $FAIL_ON_SKIP_ENV && error false $@ || skip $@ } @@ -6413,7 +6449,7 @@ remote_nodes_list () { all_mdts_nodes () { local host local failover_host - local nodes="${mds_HOST} ${mdsfailover_HOST}" + local nodes local nodes_sort local i @@ -6423,6 +6459,7 @@ all_mdts_nodes () { nodes="$nodes ${!host} ${!failover_host}" done + [ -n "$nodes" ] || nodes="${mds_HOST} ${mdsfailover_HOST}" nodes_sort=$(for i in $nodes; do echo $i; done | sort -u) echo -n $nodes_sort } @@ -6431,7 +6468,7 @@ all_mdts_nodes () { all_osts_nodes () { local host local failover_host - local nodes="${ost_HOST} ${ostfailover_HOST}" + local nodes= local nodes_sort local i @@ -6441,6 +6478,7 @@ all_osts_nodes () { nodes="$nodes ${!host} ${!failover_host}" done + [ -n "$nodes" ] || nodes="${ost_HOST} ${ostfailover_HOST}" nodes_sort=$(for i in $nodes; do echo $i; done | sort -u) echo -n $nodes_sort } @@ -6844,7 +6882,7 @@ convert_facet2label() { } get_clientosc_proc_path() { - echo "${1}-osc-ffff*" + echo "${1}-osc-[-0-9a-f]*" } # If the 2.0 MDS was mounted on 1.8 device, then the OSC and LOV names @@ -7906,6 +7944,8 @@ init_logging() { do_facet $SINGLEMDS $LCTL --version)" log "OSS: $(do_facet ost1 $LCTL lustre_build_version 2> /dev/null || do_facet ost1 $LCTL --version)" + + get_lustre_env } log_test() { @@ -8162,8 +8202,7 @@ max_xattr_size() { local size if large_xattr_enabled; then - # include/linux/limits.h: #define XATTR_SIZE_MAX 65536 - size=65536 + size=$($LCTL get_param -n llite.*.max_easize) else local mds_dev=$(mdsdevname ${SINGLEMDS//mds/}) local block_size=$(get_block_size $SINGLEMDS $mds_dev) @@ -8312,14 +8351,14 @@ generate_logname() { test_mkdir() { local path local p_option - local stripe_count=2 - local stripe_index=-1 + local dirstripe_count=${DIRSTRIPE_COUNT:-"2"} + local dirstripe_index=${DIRSTRIPE_INDEX:-$((base % $MDSCOUNT))} local OPTIND=1 while getopts "c:i:p" opt; do case $opt in - c) stripe_count=$OPTARG;; - i) stripe_index=$OPTARG;; + c) dirstripe_count=$OPTARG;; + i) dirstripe_index=$OPTARG;; p) p_option="-p";; \?) error "only support -i -c -p";; esac @@ -8342,17 +8381,25 @@ test_mkdir() { if [ $MDSCOUNT -le 1 ]; then mkdir $path || error "mkdir '$path' failed" else - local test_num=$(echo $testnum | sed -e 's/[^0-9]*//g') local mdt_index - if [ $stripe_index -eq -1 ]; then - mdt_index=$((test_num % MDSCOUNT)) + if [ $dirstripe_index -eq -1 ]; then + mdt_index=$((base % MDSCOUNT)) else - mdt_index=$stripe_index + mdt_index=$dirstripe_index fi - echo "striped dir -i$mdt_index -c$stripe_count $path" - $LFS mkdir -i$mdt_index -c$stripe_count $path || - error "mkdir -i $mdt_index -c$stripe_count $path failed" + + if (($MDS1_VERSION >= $(version_code 2.8.0))); then + if [ $dirstripe_count -eq -1 ]; then + dirstripe_count=$((RANDOM % MDSCOUNT + 1)) + fi + else + dirstripe_count=1 + fi + + echo "striped dir -i$mdt_index -c$dirstripe_count $path" + $LFS mkdir -i$mdt_index -c$dirstripe_count $path || + error "mkdir -i $mdt_index -c$dirstripe_count $path failed" fi } @@ -8687,15 +8734,15 @@ check_stripe_count() { [[ -z "$file" || -z "$expected" ]] && error "check_stripe_count: invalid argument" - local cmd="$GETSTRIPE -c $file" + local cmd="$LFS getstripe -c $file" actual=$($cmd) || error "$cmd failed" actual=${actual%% *} if [[ $actual -ne $expected ]]; then - [[ $expected -eq -1 ]] || - error "$cmd wrong: found $actual, expected $expected" - [[ $actual -eq $OSTCOUNT ]] || - error "$cmd wrong: found $actual, expected $OSTCOUNT" + [[ $expected -eq -1 ]] || { $LFS getstripe $file; + error "$cmd not expected ($expected): found $actual"; } + [[ $actual -eq $OSTCOUNT ]] || { $LFS getstripe $file; + error "$cmd not OST count ($OSTCOUNT): found $actual"; } fi } @@ -9359,3 +9406,23 @@ save_layout_restore_at_exit() { stack_trap "restore_layout $dir $layout" EXIT } + +verify_yaml_layout() { + local src=$1 + local dst=$2 + local temp=$3 + local msg_prefix=$4 + + echo "getstripe --yaml $src" + $LFS getstripe --yaml $src > $temp || error "getstripe $src failed" + echo "setstripe --yaml=$temp $dst" + $LFS setstripe --yaml=$temp $dst|| error "setstripe $dst failed" + + echo "compare" + local layout1=$(get_layout_param $src) + local layout2=$(get_layout_param $dst) + # compare their layout info + [ "$layout1" == "$layout2" ] || + error "$msg_prefix $src/$dst layouts are not equal" +} +