Whamcloud - gitweb
LU-11607 tests: replace lustre_version in mds-survey/pcc/sec
[fs/lustre-release.git] / lustre / tests / ost-pools.sh
index 1e723a6..fecd8fc 100755 (executable)
@@ -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
@@ -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=$?
@@ -1148,7 +1138,7 @@ test_20() {
        check_file_not_in_pool $dir2/file4 $POOL
        check_file_not_in_pool $dir1/file5 $POOL2
 
-       if [ $(lustre_version_code mds1) -ge $(version_code 2.10.54) ]; then
+       if [ "$MDS1_VERSION" -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
@@ -1250,7 +1240,7 @@ test_23a() {
 
        # XXX remove the interoperability code once we drop the old server
        #     ( < 2.3.50) support.
-       if [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.3.50) ]; then
+       if [ "$MDS1_VERSION" -lt $(version_code 2.3.50) ]; then
                $LFS quotaoff -ug $MOUNT
                $LFS quotacheck -ug $MOUNT
        else
@@ -1326,7 +1316,7 @@ test_23b() {
 
        # XXX remove the interoperability code once we drop the old server
        #     ( < 2.3.50) support.
-       if [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.3.50) ]; then
+       if [ "$MDS1_VERSION" -lt $(version_code 2.3.50) ]; then
                $LFS quotaoff -ug $MOUNT
        else
                if [[ $PERM_CMD == *"set_param -P"* ]]; then
@@ -1383,13 +1373,11 @@ test_23b() {
 run_test 23b "OST pools and OOS"
 
 test_24() {
-       local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
        [[ $OSTCOUNT -le 1 ]] && skip_env "needs >= 2 OSTs"
-
-       local server_version=$(lustre_version_code $SINGLEMDS)
-       [[ $server_version -ge $(version_code 2.8.56) ]] ||
+       [[ "$MDS1_VERSION" -ge $(version_code 2.8.56) ]] ||
                skip "Need server version newer than 2.8.55"
 
+       local POOL_ROOT=${POOL_ROOT:-$DIR/$tdir}
        local numfiles=10
        local i=0
        local TGT
@@ -1545,6 +1533,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--))