From e4799a53832bd1278b766ed2e0a261281b10f28c Mon Sep 17 00:00:00 2001 From: James Nunez Date: Mon, 26 Aug 2019 16:45:40 -0600 Subject: [PATCH] LU-11607 tests: replace lustre_version/fstype in sanity-scrub The routine get_lustre_env() is available to all Lustre test suites and sets an environment variable for the Lustre version and file system types of servers. In sanity-scrub, sanity-hsm and sanity-lfsck, replace calls to lustre_version_code() and facet_fstype() for all server types with definitions from get_lustre_env(). Clean up around any modifications by removing calls to return after skip() or skip_env(). Fixes: c8790ae52393 (LU-1538 tests: standardize test script init - dne-part-2) Fixes: c54b6ca2bdb5 (LU-13718 tests: add LU numbers to skipped tests) Test-Parameters: trivial fstype=ldiskfs testlist=sanity-scrub,sanity-hsm,sanity-lfsck Test-Parameters: fstype=zfs testlist=sanity-scrub,sanity-hsm,sanity-lfsck Signed-off-by: James Nunez Change-Id: I5aa2898f6efef127cf2d7f4a2f08838f503c51ab Reviewed-on: https://review.whamcloud.com/35929 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Emoly Liu Reviewed-by: Vikentsi Lapa --- lustre/tests/sanity-hsm.sh | 19 ++++++------- lustre/tests/sanity-lfsck.sh | 25 ++++++++--------- lustre/tests/sanity-scrub.sh | 65 ++++++++++++++++++++++---------------------- 3 files changed, 53 insertions(+), 56 deletions(-) diff --git a/lustre/tests/sanity-hsm.sh b/lustre/tests/sanity-hsm.sh index 37ebd70ed..12834df 100755 --- a/lustre/tests/sanity-hsm.sh +++ b/lustre/tests/sanity-hsm.sh @@ -635,8 +635,8 @@ test_1c() { error "wrong archive number, $st != $LOCAL_HSM_ARCHIVE_NUMBER" LOCAL_HSM_ARCHIVE_NUMBER=33 - if [ $(lustre_version_code client) -ge $(version_code 2.11.56) ] && - [ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.11.56) ]; then + if [ "$CLIENT_VERSION" -ge $(version_code 2.11.56) ] && + [ "$MDS1_VERSION" -ge $(version_code 2.11.56) ]; then # lustre in the new version supports unlimited archiveID. # Test whether setting archive number > 32 is supported $LFS hsm_set --exists --archive-id $LOCAL_HSM_ARCHIVE_NUMBER $f || @@ -682,7 +682,7 @@ test_1d() { run_test 1d "Archive, Release and Restore DoM file" test_1e() { - [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] && + [ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] && skip "skipped for lustre < $SEL_VER" mkdir -p $DIR/$tdir @@ -1531,7 +1531,7 @@ test_21() { # LU-4388/LU-4389 - ZFS does not report full number of blocks # used until file is flushed to disk - if [ $(facet_fstype ost1) == "zfs" ]; then + if [ "$ost1_FSTYPE" == "zfs" ]; then # this causes an OST_SYNC rpc to be sent dd if=/dev/zero of=$f bs=512 count=1 oflag=sync conv=notrunc,fsync # clear locks to reread file data @@ -5045,13 +5045,13 @@ run_test 407 "Check for double RESTORE records in llog" test_500() { - [ $MDS1_VERSION -lt $(version_code 2.6.92) ] && + [ "$MDS1_VERSION" -lt $(version_code 2.6.92) ] && skip "HSM migrate is not supported" test_mkdir -p $DIR/$tdir - if [ $(lustre_version_code client) -lt $(version_code 2.11.56) ] || - [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.11.56) ]; + if [ "$CLIENT_VERSION" -lt $(version_code 2.11.56) ] || + [ "$MDS1_VERSION" -lt $(version_code 2.11.56) ]; then llapi_hsm_test -d $DIR/$tdir -b || error "One llapi HSM test failed" @@ -5063,7 +5063,7 @@ test_500() run_test 500 "various LLAPI HSM tests" test_600() { - [ $MDS1_VERSION -lt $(version_code 2.10.58) ] && + [ "$MDS1_VERSION" -lt $(version_code 2.10.58) ] && skip "need MDS version at least 2.10.58" mkdir -p $DIR/$tdir @@ -5355,8 +5355,7 @@ test_606() { local llog_reader=$(do_facet mgs "which llog_reader 2> /dev/null") llog_reader=${llog_reader:-$LUSTRE/utils/llog_reader} [ -z $(do_facet mgs ls -d $llog_reader 2> /dev/null) ] && - skip_env "missing llog_reader" && return - local fstype=$(facet_fstype mds1) + skip_env "missing llog_reader" mkdir -p $DIR/$tdir diff --git a/lustre/tests/sanity-lfsck.sh b/lustre/tests/sanity-lfsck.sh index 967b7d2..c2bf325 100644 --- a/lustre/tests/sanity-lfsck.sh +++ b/lustre/tests/sanity-lfsck.sh @@ -40,9 +40,9 @@ SAVED_OSTCOUNT=${OSTCOUNT} # use small MDS + OST size to speed formatting time # do not use too small MDSSIZE/OSTSIZE, which affect the default journal size MDSSIZE=100000 -[ $(facet_fstype $SINGLEMDS) == zfs ] && MDSSIZE=300000 +[ "$mds1_FSTYPE" == zfs ] && MDSSIZE=300000 OSTSIZE=100000 -[ $(facet_fstype ost1) == zfs ] && OSTSIZE=300000 +[ "$ost1_FSTYPE" == zfs ] && OSTSIZE=300000 # no need too many OSTs, to reduce the format/start/stop overhead cleanupall @@ -241,8 +241,8 @@ run_test 1a "LFSCK can find out and repair crashed FID-in-dirent" test_1b() { - [ $(facet_fstype $SINGLEMDS) != ldiskfs ] && - skip "OI Scrub not implemented for ZFS" && return + [ "$mds1_FSTYPE" != ldiskfs ] && + skip "OI Scrub not implemented for ZFS" lfsck_prep 1 1 @@ -560,8 +560,8 @@ run_test 3 "LFSCK can verify multiple-linked objects" test_4() { - [ $(facet_fstype $SINGLEMDS) != ldiskfs ] && - skip "OI Scrub not implemented for ZFS" && return + [ "$mds1_FSTYPE" != ldiskfs ] && + skip "OI Scrub not implemented for ZFS" lfsck_prep 3 3 cleanup_mount $MOUNT || error "(0.1) Fail to stop client!" @@ -620,8 +620,8 @@ run_test 4 "FID-in-dirent can be rebuilt after MDT file-level backup/restore" test_5() { - [ $(facet_fstype $SINGLEMDS) != ldiskfs ] && - skip "OI Scrub not implemented for ZFS" && return + [ "$mds1_FSTYPE" != ldiskfs ] && + skip "OI Scrub not implemented for ZFS" lfsck_prep 1 1 1 cleanup_mount $MOUNT || error "(0.1) Fail to stop client!" @@ -5281,9 +5281,8 @@ run_test 33 "check LFSCK paramters" test_34() { - [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return - [ $(facet_fstype $SINGLEMDS) != zfs ] && - skip "Only valid for ZFS backend" && return + [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" + [ "$mds1_FSTYPE" != zfs ] && skip "Only valid for ZFS backend" lfsck_prep 1 1 @@ -5705,7 +5704,7 @@ run_test 37 "LFSCK must skip a ORPHAN" test_38() { - [[ $MDS1_VERSION -le $(version_code 2.12.51) ]] && + [[ "$MDS1_VERSION" -le $(version_code 2.12.51) ]] && skip "Need MDS version newer than 2.12.51" test_mkdir $DIR/$tdir @@ -5792,7 +5791,7 @@ run_test 38 "LFSCK does not break foreign file and reverse is also true" test_39() { - [[ $(lustre_version_code $SINGLEMDS) -le $(version_code 2.12.51) ]] && + [[ "$MDS1_VERSION" -le $(version_code 2.12.51) ]] && skip "Need MDS version newer than 2.12.51" test_mkdir $DIR/$tdir diff --git a/lustre/tests/sanity-scrub.sh b/lustre/tests/sanity-scrub.sh index ac75e5d..8c12490 100644 --- a/lustre/tests/sanity-scrub.sh +++ b/lustre/tests/sanity-scrub.sh @@ -130,7 +130,7 @@ scrub_prep() { } [ ! -z $inject ] && [ $inject -eq 1 ] && - [ $(facet_fstype $SINGLEMDS) = "zfs" ] && { + [ "$mds1_FSTYPE" = "zfs" ] && { #define OBD_FAIL_OSD_FID_MAPPING 0x193 do_nodes $(comma_list $(mdts_nodes)) \ $LCTL set_param fail_loc=0x193 @@ -161,7 +161,7 @@ scrub_prep() { stop mds$n > /dev/null || error "Fail to stop MDS$n!" done - [ ! -z $inject ] && [ $(facet_fstype $SINGLEMDS) = "ldiskfs" ] && { + [ ! -z $inject ] && [ "$mds1_FSTYPE" = "ldiskfs" ] && { if [ $inject -eq 1 ]; then for n in $(seq $MDSCOUNT); do mds_backup_restore mds$n || @@ -296,7 +296,7 @@ scrub_check_data2() { } scrub_remove_ois() { - [ $(facet_fstype $SINGLEMDS) != "ldiskfs" ] && return + [ "$mds1_FSTYPE" != "ldiskfs" ] && return local error_id=$1 local index=$2 @@ -314,7 +314,7 @@ scrub_enable_auto() { } full_scrub_ratio() { - [ $(facet_fstype $SINGLEMDS) != "ldiskfs" ] && return + [ "$mds1_FSTYPE" != "ldiskfs" ] && return local ratio=$1 @@ -323,7 +323,7 @@ full_scrub_ratio() { } full_scrub_threshold_rate() { - [ $(facet_fstype $SINGLEMDS) != "ldiskfs" ] && return + [ "$mds1_FSTYPE" != "ldiskfs" ] && return local rate=$1 @@ -387,7 +387,7 @@ test_1b() { scrub_prep 0 2 echo "start MDTs without disabling OI scrub" scrub_start_mds 2 "$MOUNT_OPTS_SCRUB" - [ $(facet_fstype $SINGLEMDS) != "ldiskfs" ] || + [ "$mds1_FSTYPE" != "ldiskfs" ] || scrub_check_status 3 completed mount_client $MOUNT || error "(4) Fail to start client!" scrub_check_data2 runas 5 @@ -396,8 +396,8 @@ test_1b() { run_test 1b "Trigger OI scrub when MDT mounts for OI files remove/recreate case" test_1c() { - [ $(facet_fstype $SINGLEMDS) != "ldiskfs" ] && - skip "ldiskfs special test" && return + [ "$mds1_FSTYPE" != "ldiskfs" ] && + skip "ldiskfs special test" local index @@ -419,8 +419,8 @@ test_1c() { run_test 1c "Auto detect kinds of OI file(s) removed/recreated cases" test_2() { - [ $(facet_fstype $SINGLEMDS) != "ldiskfs" ] && - skip "ldiskfs special test" && return + [ "$mds1_FSTYPE" != "ldiskfs" ] && + skip "ldiskfs special test" scrub_prep 0 1 echo "starting MDTs without disabling OI scrub" @@ -440,7 +440,7 @@ test_3() { echo "starting MDTs with OI scrub disabled" scrub_start_mds 2 "$MOUNT_OPTS_NOSCRUB" scrub_check_status 3 init - [ $(facet_fstype $SINGLEMDS) != "ldiskfs" ] || + [ "$mds1_FSTYPE" != "ldiskfs" ] || scrub_check_flags 4 recreated,inconsistent } #run_test 3 "Do not trigger OI scrub when MDT mounts if 'noscrub' specified" @@ -449,7 +449,7 @@ test_4a() { scrub_prep 0 1 echo "starting MDTs with OI scrub disabled" scrub_start_mds 2 "$MOUNT_OPTS_NOSCRUB" - [ $(facet_fstype $SINGLEMDS) != "ldiskfs" ] || + [ "$mds1_FSTYPE" != "ldiskfs" ] || scrub_check_flags 4 recreated,inconsistent mount_client $MOUNT || error "(5) Fail to start client!" scrub_enable_auto @@ -480,8 +480,8 @@ test_4a() { run_test 4a "Auto trigger OI scrub if bad OI mapping was found (1)" test_4b() { - [ $(facet_fstype $SINGLEMDS) != "ldiskfs" ] && - skip "ldiskfs special test" && return + [ "$mds1_FSTYPE" != "ldiskfs" ] && + skip "ldiskfs special test" scrub_prep 5 1 echo "starting MDTs with OI scrub disabled" @@ -567,8 +567,8 @@ test_4b() { run_test 4b "Auto trigger OI scrub if bad OI mapping was found (2)" test_4c() { - [ $(facet_fstype $SINGLEMDS) != "ldiskfs" ] && - skip "ldiskfs special test" && return + [ "$mds1_FSTYPE" != "ldiskfs" ] && + skip "ldiskfs special test" scrub_prep 500 1 echo "starting MDTs with OI scrub disabled" @@ -654,7 +654,7 @@ test_4c() { run_test 4c "Auto trigger OI scrub if bad OI mapping was found (3)" test_4d() { - [ $(facet_fstype $SINGLEMDS) != "ldiskfs" ] && skip "ldiskfs only test" + [ "$mds1_FSTYPE" != "ldiskfs" ] && skip "ldiskfs only test" check_mount_and_prep @@ -683,7 +683,7 @@ test_5() { echo "starting MDTs with OI scrub disabled (1)" scrub_start_mds 2 "$MOUNT_OPTS_NOSCRUB" scrub_check_status 3 init - [ $(facet_fstype $SINGLEMDS) != "ldiskfs" ] || + [ "$mds1_FSTYPE" != "ldiskfs" ] || scrub_check_flags 4 recreated,inconsistent mount_client $MOUNT || error "(5) Fail to start client!" scrub_enable_auto @@ -751,7 +751,7 @@ test_6() { scrub_prep 100 1 echo "starting MDTs with OI scrub disabled" scrub_start_mds 2 "$MOUNT_OPTS_NOSCRUB" - [ $(facet_fstype $SINGLEMDS) != "ldiskfs" ] || + [ "$mds1_FSTYPE" != "ldiskfs" ] || scrub_check_flags 4 recreated,inconsistent mount_client $MOUNT || error "(5) Fail to start client!" scrub_enable_auto @@ -829,7 +829,7 @@ test_7() { scrub_prep 500 1 echo "starting MDTs with OI scrub disabled" scrub_start_mds 2 "$MOUNT_OPTS_NOSCRUB" - [ $(facet_fstype $SINGLEMDS) != "ldiskfs" ] || + [ "$mds1_FSTYPE" != "ldiskfs" ] || scrub_check_flags 4 recreated,inconsistent mount_client $MOUNT || error "(5) Fail to start client!" scrub_enable_auto @@ -848,7 +848,7 @@ test_7() { done scrub_check_status 8 scanning - if [ $(facet_fstype $SINGLEMDS) != "ldiskfs" ]; then + if [ "$mds1_FSTYPE" != "ldiskfs" ]; then scrub_check_flags 9 inconsistent,auto else scrub_check_flags 9 recreated,inconsistent,auto @@ -866,7 +866,7 @@ test_8() { scrub_prep 128 1 echo "starting MDTs with OI scrub disabled" scrub_start_mds 2 "$MOUNT_OPTS_NOSCRUB" - [ $(facet_fstype $SINGLEMDS) != "ldiskfs" ] || + [ "$mds1_FSTYPE" != "ldiskfs" ] || scrub_check_flags 4 recreated,inconsistent #define OBD_FAIL_OSD_SCRUB_DELAY 0x190 @@ -890,12 +890,11 @@ run_test 8 "Control OI scrub manually" test_9() { # Skip scrub speed test for ZFS because of performance unstable - [ $(facet_fstype $SINGLEMDS) != "ldiskfs" ] && - skip "test scrub speed only on ldiskfs" && return + [ "$mds1_FSTYPE" != "ldiskfs" ] && + skip "test scrub speed only on ldiskfs" if [ -z "$(grep "processor.*: 1" /proc/cpuinfo)" ]; then skip "Testing on UP system, the speed may be inaccurate." - return 0 fi scrub_prep 6000 1 @@ -975,7 +974,7 @@ test_10a() { scrub_prep 0 1 echo "starting mds$n with OI scrub disabled (1)" scrub_start_mds 2 "$MOUNT_OPTS_NOSCRUB" - [ $(facet_fstype $SINGLEMDS) != "ldiskfs" ] || + [ "$mds1_FSTYPE" != "ldiskfs" ] || scrub_check_flags 4 recreated,inconsistent mount_client $MOUNT || error "(5) Fail to start client!" scrub_enable_auto @@ -1010,7 +1009,7 @@ test_10b() { scrub_prep 0 1 echo "starting MDTs with OI scrub disabled" scrub_start_mds 2 "$MOUNT_OPTS_NOSCRUB" - [ $(facet_fstype $SINGLEMDS) != "ldiskfs" ] || + [ "$mds1_FSTYPE" != "ldiskfs" ] || scrub_check_flags 4 recreated,inconsistent #define OBD_FAIL_OSD_SCRUB_DELAY 0x190 @@ -1037,8 +1036,8 @@ test_10b() { #run_test 10b "non-stopped OI scrub should auto restarts after MDS remount (2)" test_11() { - [ $(facet_fstype $SINGLEMDS) != "ldiskfs" ] && - skip "ldiskfs special test" && return + [ "$mds1_FSTYPE" != "ldiskfs" ] && + skip "ldiskfs special test" local CREATED=100 local n @@ -1162,7 +1161,7 @@ test_13() { run_test 13 "OI scrub can rebuild missed /O entries" test_14() { - [ $(facet_fstype $SINGLEMDS) != "ldiskfs" ] && + [ "$mds1_FSTYPE" != "ldiskfs" ] && skip "ldiskfs special test" check_mount_and_prep @@ -1213,13 +1212,13 @@ test_15() { echo "starting MDTs with OI scrub disabled" scrub_start_mds 2 "$MOUNT_OPTS_NOSCRUB" scrub_check_status 3 init - [ $(facet_fstype $SINGLEMDS) != "ldiskfs" ] || + [ "$mds1_FSTYPE" != "ldiskfs" ] || scrub_check_flags 4 recreated,inconsistent # run under dryrun mode scrub_start 5 --dryrun scrub_check_status 6 completed - if [ $(facet_fstype $SINGLEMDS) != "ldiskfs" ]; then + if [ "$mds1_FSTYPE" != "ldiskfs" ]; then scrub_check_flags 7 inconsistent repaired=2 else @@ -1232,7 +1231,7 @@ test_15() { # run under dryrun mode again scrub_start 10 --dryrun scrub_check_status 11 completed - if [ $(facet_fstype $SINGLEMDS) != "ldiskfs" ]; then + if [ "$mds1_FSTYPE" != "ldiskfs" ]; then scrub_check_flags 12 inconsistent else scrub_check_flags 12 recreated,inconsistent -- 1.8.3.1