X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Ftests%2Fost-pools.sh;h=2f1700f7b70e5a3e8341ae3f5f9e3b16074f93a5;hp=7773e3b6e012f351d7f49b94ca76c201cf77e6cd;hb=c8790ae52393d96fc71aa4edea0e5051c54431e9;hpb=bb4c3bc38eeeeec111c14c024669465addb30c70 diff --git a/lustre/tests/ost-pools.sh b/lustre/tests/ost-pools.sh index 7773e3b..2f1700f 100755 --- a/lustre/tests/ost-pools.sh +++ b/lustre/tests/ost-pools.sh @@ -4,26 +4,20 @@ # Skip specific tests by setting EXCEPT. # -SRCDIR=$(dirname $0) -export PATH=$PWD/$SRCDIR:$SRCDIR:$PWD/$SRCDIR/../utils:$PATH:/sbin - ONLY=${ONLY:-"$*"} -ALWAYS_EXCEPT="$OST_POOLS_EXCEPT" -# bug number for skipped test: - -# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT! - -[ "$ALWAYS_EXCEPT$EXCEPT" ] && - echo "Skipping tests: $(echo $ALWAYS_EXCEPT $EXCEPT)" - -TMP=${TMP:-/tmp} ORIG_PWD=${PWD} -LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)} +LUSTRE=${LUSTRE:-$(dirname $0)/..} . $LUSTRE/tests/test-framework.sh init_test_env $@ -. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh} init_logging +ALWAYS_EXCEPT="$OST_POOLS_EXCEPT" +# bug number for skipped test: - +# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT! + +build_test_filter + check_and_setup_lustre if ! combined_mgs_mds; then @@ -32,14 +26,9 @@ if ! combined_mgs_mds; then error "unable to mount $MOUNT on the MGS" fi -# 9 12.5 (min)" -[ "$SLOW" = "no" ] && EXCEPT_SLOW="18 23b" - DIR=${DIR:-$MOUNT} assert_DIR -build_test_filter - MAXFREE=${MAXFREE:-$((2000000 * OSTCOUNT))} # OST pools tests @@ -217,8 +206,8 @@ ost_pools_init() { } # Initialization -remote_mds_nodsh && skip "remote MDS with nodsh" && exit 0 -remote_ost_nodsh && skip "remote OST with nodsh" && exit 0 +remote_mds_nodsh && skip "remote MDS with nodsh" +remote_ost_nodsh && skip "remote OST with nodsh" ost_pools_init # Tests for new commands added @@ -281,14 +270,14 @@ test_1i() { run_test 1i "pool_new should fail if poolname and fs-name are missing" test_1j() { - create_pool ${FSNAME},$POOL + do_facet mgs lctl pool_new ${FSNAME},$POOL [[ $? -ne 0 ]] || error "pool_new did not fail even if poolname format was wrong" } run_test 1j "pool_new should fail if poolname format is wrong" test_1k() { - create_pool ${FSNAME}/$POOL + do_facet mgs lctl pool_new ${FSNAME}/$POOL [[ $? -ne 0 ]] || error "pool_new did not fail even if poolname format was wrong" } @@ -418,10 +407,11 @@ test_2e() { create_pool_nofail $POOL - TGT="$FSNAME-OST0000_UUID " + TGT="$FSNAME-OST0000_UUID" do_facet mgs lctl pool_add $FSNAME.$POOL $TGT - wait_update $HOSTNAME "lctl get_param -n lov.$FSNAME-*.pools.$POOL | - sort -u | tr '\n' ' ' " "$TGT" || error "Add to pool failed" + wait_update_facet $SINGLEMDS \ + "lctl pool_list $FSNAME.$POOL | sed '1d'" "$TGT" || + error "Add $TGT to $FSNAME.$POOL failed" RESULT=$(do_facet mgs \ "LOCALE=C $LCTL pool_add $FSNAME.$POOL $TGT 2>&1") RC=$? @@ -593,31 +583,31 @@ test_6() { add_pool $POOL $TGT_ALL "$TGT_UUID" mkdir -p $POOL_DIR - $SETSTRIPE -c -1 -p $POOL $POOL_DIR - [[ $? -eq 0 ]] || error "$SETSTRIPE -p $POOL failed." + $LFS setstripe -c -1 -p $POOL $POOL_DIR + [[ $? -eq 0 ]] || error "$LFS setstripe -p $POOL failed." check_dir_in_pool $POOL_DIR $POOL # If an invalid pool name is specified, the command should fail - $SETSTRIPE -c 2 -p $INVALID_POOL $POOL_DIR 2>/dev/null + $LFS setstripe -c 2 -p $INVALID_POOL $POOL_DIR 2>/dev/null [[ $? -ne 0 ]] || error "setstripe to invalid pool did not fail." # If the pool name does not exist, the command should fail - $SETSTRIPE -c 2 -p $NON_EXISTANT_POOL $POOL_DIR 2>/dev/null + $LFS setstripe -c 2 -p $NON_EXISTANT_POOL $POOL_DIR 2>/dev/null [[ $? -ne 0 ]] || error "setstripe to non-existant pool did not fail." # lfs setstripe should work as before if a pool name is not specified. - $SETSTRIPE -c -1 $POOL_DIR - [[ $? -eq 0 ]] || error "$SETSTRIPE -p $POOL_DIR failed." - $SETSTRIPE -c -1 $POOL_FILE - [[ $? -eq 0 ]] || error "$SETSTRIPE -p $POOL_FILE failed." + $LFS setstripe -c -1 $POOL_DIR + [[ $? -eq 0 ]] || error "$LFS setstripe -c -1 $POOL_DIR failed." + $LFS setstripe -c -1 $POOL_FILE + [[ $? -eq 0 ]] || error "$LFS setstripe -c -1 $POOL_FILE failed." # lfs setstripe should fail if a start index that is outside the # pool is specified. create_pool_nofail $POOL2 add_pool $POOL2 "OST0000" "$FSNAME-OST0000_UUID " - $SETSTRIPE -i 1 -p $POOL2 $ROOT_POOL/$tfile 2>/dev/null + $LFS setstripe -i 1 -p $POOL2 $ROOT_POOL/$tfile 2>/dev/null [[ $? -ne 0 ]] || - error "$SETSTRIPE with start index outside the pool did not fail." + error "$LFS setstripe with start index outside the pool did not fail." } run_test 6 "getstripe/setstripe" @@ -629,15 +619,15 @@ helper_test_7a() pool_add $pool || error "pool_add failed" pool_add_targets $pool 0 1 || error "pool_add_targets failed" - $SETSTRIPE -c 1 $DIR/$tdir/testfile1 --pool "$pool" || \ + $LFS setstripe -c 1 $DIR/$tdir/testfile1 --pool "$pool" || error "setstripe failed" - $SETSTRIPE -c 1 $DIR/$tdir/testfile2 --pool "$FSNAME.$pool" || \ + $LFS setstripe -c 1 $DIR/$tdir/testfile2 --pool "$FSNAME.$pool" || error "setstripe failed" mkdir $DIR/$tdir/testdir - $SETSTRIPE -c 1 $DIR/$tdir/testdir -p "$pool" || \ + $LFS setstripe -c 1 $DIR/$tdir/testdir -p "$pool" || error "setstripe failed" - $SETSTRIPE -c 1 $DIR/$tdir/testdir -p "$FSNAME.$pool" || \ + $LFS setstripe -c 1 $DIR/$tdir/testdir -p "$FSNAME.$pool" || error "setstripe failed" rm -f $DIR/$tdir/testfile1 @@ -649,7 +639,7 @@ helper_test_7a() test_7a() { - [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return + [ $OSTCOUNT -lt 2 ] && skip_env "needs >= 2 OSTs" mkdir -p $DIR/$tdir @@ -688,7 +678,7 @@ run_test 7b "try to create pool name with invalid lengths or names" test_7c() { - [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return + [ $OSTCOUNT -lt 2 ] && skip_env "needs >= 2 OSTs" mkdir -p $DIR/$tdir @@ -698,11 +688,11 @@ test_7c() pool_add_targets $pool 0 1 || error "pool_add_targets failed" # setstripe with the same pool name plus 1 letter - $SETSTRIPE -c 1 $DIR/$tdir/testfile1 --pool "${pool}X" && \ + $LFS setstripe -c 1 $DIR/$tdir/testfile1 --pool "${pool}X" && error "setstripe succedeed" # setstripe with the same pool name minus 1 letter - $SETSTRIPE -c 1 $DIR/$tdir/testfile1 --pool "${pool%?}" && \ + $LFS setstripe -c 1 $DIR/$tdir/testfile1 --pool "${pool%?}" && error "setstripe succedeed" rm -f $DIR/$tdir/testfile1 @@ -714,7 +704,7 @@ run_test 7c "create a valid pool name and setstripe with a bad one" test_11() { local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir} - [[ $OSTCOUNT -le 1 ]] && skip_env "needs >= 2 OSTs" && return + [[ $OSTCOUNT -le 1 ]] && skip_env "needs >= 2 OSTs" create_pool_nofail $POOL create_pool_nofail $POOL2 @@ -751,7 +741,7 @@ run_test 11 "OSTs in overlapping/multiple pools" test_12() { local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir} - [[ $OSTCOUNT -le 2 ]] && skip_env "needs >=3 OSTs" && return + [[ $OSTCOUNT -le 2 ]] && skip_env "needs >=3 OSTs" create_pool_nofail $POOL create_pool_nofail $POOL2 @@ -801,7 +791,7 @@ test_12() { run_test 12 "OST Pool Membership" test_13() { - [[ $OSTCOUNT -le 2 ]] && skip_env "needs >= 3 OSTs" && return + [[ $OSTCOUNT -le 2 ]] && skip_env "needs >= 3 OSTs" local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir} local numfiles=10 @@ -859,15 +849,14 @@ test_13() { run_test 13 "Striping characteristics in a pool" test_14() { - [[ $OSTCOUNT -le 2 ]] && skip_env "needs >= 3 OSTs" && return + [[ $OSTCOUNT -le 2 ]] && skip_env "needs >= 3 OSTs" local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir} local numfiles=100 local i [ $OSTSIZE -gt $((MAXFREE / OSTCOUNT)) ] && - skip_env "OST size $OSTSIZE is larger than $((MAXFREE / OSTCOUNT))" && - return 0 + skip_env "OST size $OSTSIZE is larger than $((MAXFREE / OSTCOUNT))" create_pool_nofail $POOL create_pool_nofail $POOL2 @@ -1112,6 +1101,8 @@ test_19() { run_test 19 "Pools should not come into play when not specified" test_20() { + [[ $OSTCOUNT -ge 2 ]] || skip_env "needs >= 2 OSTs" + local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir} local numfiles=12 local dir1=$POOL_ROOT/dir1 @@ -1131,25 +1122,28 @@ test_20() { add_pool $POOL2 "$FSNAME-OST[$start-$TGT_MAX/2]" "$TGT" create_dir $dir1 $POOL - create_file $dir1/file1 $POOL2 + create_file $dir1/file1 $POOL2 # Should replace $dir1 pool with $POOL2 create_dir $dir2 $POOL2 - touch $dir2/file2 - mkdir $dir3 - $SETSTRIPE -c 1 $dir3 # No pool assignment - touch $dir3/file3 - $SETSTRIPE -c 1 $dir2/file4 # No pool assignment + touch $dir2/file2 # Should inherit $POOL2 from $dir2 + mkdir $dir3 # Should inherit $POOL from $dir1 + $LFS setstripe -c 1 $dir3 # Should remain existing $POOL + touch $dir3/file3 # Should inherit $POOL from $dir3 + $LFS setstripe -c 1 $dir2/file4 # Should inherit $POOL2 from dir2 + $LFS setstripe -S 64K $dir1/file5 # Should inderit $POOL from $dir1 check_file_in_pool $dir1/file1 $POOL2 check_file_in_pool $dir2/file2 $POOL2 - - check_dir_not_in_pool $dir3 $POOL check_dir_not_in_pool $dir3 $POOL2 - - check_file_not_in_pool $dir3/file3 $POOL check_file_not_in_pool $dir3/file3 $POOL2 - check_file_not_in_pool $dir2/file4 $POOL - check_file_not_in_pool $dir2/file4 $POOL2 + check_file_not_in_pool $dir1/file5 $POOL2 + + if [ $(lustre_version_code mds1) -ge $(version_code 2.10.54) ]; then + check_dir_in_pool $dir3 $POOL + check_file_in_pool $dir3/file3 $POOL + check_file_in_pool $dir2/file4 $POOL2 + check_file_in_pool $dir1/file5 $POOL + fi rm -rf $dir1 @@ -1159,7 +1153,7 @@ run_test 20 "Different pools in a directory hierarchy." test_21() { local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir} - [[ $OSTCOUNT -le 1 ]] && skip_env "needs >= 2 OSTs" && return + [[ $OSTCOUNT -le 1 ]] && skip_env "needs >= 2 OSTs" local numfiles=12 local i=0 @@ -1201,7 +1195,7 @@ add_loop() { test_22() { local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir} - [[ $OSTCOUNT -le 1 ]] && skip_env "needs >= 2 OSTs" && return + [[ $OSTCOUNT -le 1 ]] && skip_env "needs >= 2 OSTs" local numfiles=100 @@ -1224,13 +1218,11 @@ run_test 22 "Simultaneous manipulation of a pool" test_23a() { local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir} - [[ $OSTCOUNT -le 1 ]] && skip_env "needs >= 2 OSTs" && return + [[ $OSTCOUNT -le 1 ]] && skip_env "needs >= 2 OSTs" mkdir -p $POOL_ROOT - check_runas_id $RUNAS_ID $RUNAS_GID $RUNAS || { + check_runas_id $RUNAS_ID $RUNAS_GID $RUNAS || skip_env "User $RUNAS_ID does not exist - skipping" - return 0 - } local i=0 local TGT @@ -1252,7 +1244,12 @@ test_23a() { $LFS quotaoff -ug $MOUNT $LFS quotacheck -ug $MOUNT else - do_facet mgs $LCTL conf_param $FSNAME.quota.ost=ug + if [[ $PERM_CMD == *"set_param -P"* ]]; then + do_facet mgs $PERM_CMD \ + osd-*.$FSNAME-OST*.quota_slave.enable=ug + else + do_facet mgs $PERM_CMD $FSNAME.quota.ost=ug + fi sleep 5 fi @@ -1260,7 +1257,7 @@ test_23a() { sleep 3 $LFS quota -v -u $RUNAS_ID $dir - $SETSTRIPE -c 1 -p $POOL $file + $LFS setstripe -c 1 -p $POOL $file chown $RUNAS_ID.$RUNAS_GID $file ls -l $file @@ -1289,12 +1286,11 @@ run_test 23a "OST pools and quota" test_23b() { local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir} - [[ $OSTCOUNT -le 1 ]] && skip_env "needs >= 2 OSTs" && return 0 + [[ $OSTCOUNT -le 1 ]] && skip_env "needs >= 2 OSTs" mkdir -p $POOL_ROOT check_runas_id $RUNAS_ID $RUNAS_GID $RUNAS || { skip_env "User $RUNAS_ID does not exist - skipping" - return 0 } local i=0 @@ -1313,7 +1309,7 @@ test_23b() { local AVAIL=$(lfs_df -p $POOL $dir | awk '/summary/ { print $4 }') [ $AVAIL -gt $maxfree ] && skip_env "Filesystem space $AVAIL is larger than " \ - "$maxfree limit" && return 0 + "$maxfree limit" echo "OSTCOUNT=$OSTCOUNT, OSTSIZE=$OSTSIZE, AVAIL=$AVAIL" echo "MAXFREE=$maxfree, SLOW=$SLOW" @@ -1323,7 +1319,12 @@ test_23b() { if [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.3.50) ]; then $LFS quotaoff -ug $MOUNT else - do_facet mgs $LCTL conf_param $FSNAME.quota.ost=none + if [[ $PERM_CMD == *"set_param -P"* ]]; then + do_facet mgs $PERM_CMD \ + osd-*.$FSNAME-OST*.quota_slave.enable=none + else + do_facet mgs $PERM_CMD $FSNAME.quota.ost=none + fi sleep 5 fi @@ -1373,11 +1374,11 @@ run_test 23b "OST pools and OOS" test_24() { local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir} - [[ $OSTCOUNT -le 1 ]] && skip_env "needs >= 2 OSTs" && return + [[ $OSTCOUNT -le 1 ]] && skip_env "needs >= 2 OSTs" local server_version=$(lustre_version_code $SINGLEMDS) - [[ $server_version -ge $(version_code 2.8.56) ]] || - { skip "Need server version newer than 2.8.55"; return 0; } + [[ $server_version -ge $(version_code 2.8.56) ]] || + skip "Need server version newer than 2.8.55" local numfiles=10 local i=0 @@ -1392,12 +1393,12 @@ test_24() { create_dir $POOL_ROOT/dir1 $POOL $OSTCOUNT mkdir $POOL_ROOT/dir2 - $SETSTRIPE -p $POOL -S 65536 -i 0 -c 1 $POOL_ROOT/dir2 || - error "$SETSTRIPE $POOL_ROOT/dir2 failed" + $LFS setstripe -p $POOL -S 65536 -i 0 -c 1 $POOL_ROOT/dir2 || + error "$LFS setstripe $POOL_ROOT/dir2 failed" mkdir $POOL_ROOT/dir3 - $SETSTRIPE -S 65536 -i 0 -c 1 $POOL_ROOT/dir3 || - error "$SETSTRIPE $POOL_ROOT/dir3 failed" + $LFS setstripe -S 65536 -i 0 -c 1 $POOL_ROOT/dir3 || + error "$LFS setstripe $POOL_ROOT/dir3 failed" mkdir $POOL_ROOT/dir4 @@ -1428,7 +1429,13 @@ test_24() { [[ "$pool" != "$pool1" ]] && error "Pool '$pool' not on $file:$pool1" [[ "$count" != "$count1" ]] && - error "Stripe count $count not on $file:$count1" + [[ "$count" != "-1" ]] && + error "Stripe count $count not on"\ + "$file:$count1" + [[ "$count1" != "$OSTCOUNT" ]] && + [[ "$count" = "-1" ]] && + error "Stripe count $count1 not on"\ + "$file:$OSTCOUNT" [[ "$size" != "$size1" ]] && [[ "$size" != "0" ]] && error "Stripe size $size not on $file:$size1" done @@ -1464,7 +1471,7 @@ test_25() { sleep 5 # Make sure OST0 can be striped on - $SETSTRIPE -i 0 -c 1 $POOL_ROOT/$tfile + $LFS setstripe -i 0 -c 1 $POOL_ROOT/$tfile local STR=$($LFS getstripe -i $POOL_ROOT/$tfile) rm $POOL_ROOT/$tfile if [[ "$STR" == "0" ]]; then @@ -1481,7 +1488,7 @@ test_25() { run_test 25 "Create new pool and restart MDS" test_26() { - [[ $OSTCOUNT -le 2 ]] && skip_env "needs >= 3 OSTs" && return + [[ $OSTCOUNT -le 2 ]] && skip_env "needs >= 3 OSTs" local dev=$(mdsdevname ${SINGLEMDS//mds/}) local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir} @@ -1520,7 +1527,7 @@ test_26() { run_test 26 "Choose other OSTs in the pool first in the creation remedy" test_27() { - [[ $OSTCOUNT -le 1 ]] && skip_env "Need at least 2 OSTs" && return + [[ $OSTCOUNT -le 1 ]] && skip_env "Need at least 2 OSTs" local osts local pid @@ -1528,6 +1535,9 @@ test_27() { create_pool_nofail $POOL do_facet mgs lctl pool_add $FSNAME.$POOL $TGT_ALL + wait_update_facet $SINGLEMDS \ + "lctl pool_list $FSNAME.$POOL | wc -l" "$((OSTCOUNT + 1))" || + error "MDS: pool_list $FSNAME.$POOL failed" osts=$(list_pool $FSNAME.$POOL) for ost in ${osts}; do ((count--))