Whamcloud - gitweb
LU-14090 mgs: no local logs flag
[fs/lustre-release.git] / lustre / tests / conf-sanity.sh
index 57b97c7..f540da2 100644 (file)
@@ -20,9 +20,7 @@ ALWAYS_EXCEPT="$ALWAYS_EXCEPT  110 115"
 
 if $SHARED_KEY; then
        # bug number for skipped tests: LU-9795 (all below)
-       ALWAYS_EXCEPT="$ALWAYS_EXCEPT   0       31      32a     32d     35a"
-       ALWAYS_EXCEPT="$ALWAYS_EXCEPT   53a     53b     54b     76a     76b"
-       ALWAYS_EXCEPT="$ALWAYS_EXCEPT   76c     76d     78      103"
+       ALWAYS_EXCEPT="$ALWAYS_EXCEPT   84      86      103"
 fi
 
 if ! combined_mgs_mds; then
@@ -140,6 +138,9 @@ start_mds() {
        for num in $(seq $MDSCOUNT); do
                start_mdt $num $@ || return 94
        done
+       for num in $(seq $MDSCOUNT); do
+               wait_clients_import_state ${CLIENTS:-$HOSTNAME} mds${num} FULL
+       done
 }
 
 start_mgsmds() {
@@ -165,6 +166,7 @@ stop_mgs() {
 start_ost() {
        echo "start ost1 service on `facet_active_host ost1`"
        start ost1 $(ostdevname 1) $OST_MOUNT_OPTS $@ || return 95
+       wait_clients_import_state ${CLIENTS:-$HOSTNAME} ost1 FULL
 }
 
 stop_ost() {
@@ -176,6 +178,7 @@ stop_ost() {
 start_ost2() {
        echo "start ost2 service on `facet_active_host ost2`"
        start ost2 $(ostdevname 2) $OST_MOUNT_OPTS $@ || return 92
+       wait_clients_import_state ${CLIENTS:-$HOSTNAME} ost2 FULL
 }
 
 stop_ost2() {
@@ -6306,23 +6309,15 @@ test_86() {
        [[ "$MDS1_VERSION" -ge $(version_code 2.7.56) ]] ||
                skip "Need server version newer than 2.7.55"
 
-       local OST_OPTS="$(mkfs_opts ost1 $(ostdevname 1)) \
-               --reformat $(ostdevname 1) $(ostvdevname 1)"
-
        local NEWSIZE=1024
        local OLDSIZE=$(do_facet ost1 "$DEBUGFS -c -R stats $(ostdevname 1)" |
                awk '/Flex block group size: / { print $NF; exit; }')
 
-       local opts=OST_OPTS
-       if [[ ${!opts} != *mkfsoptions* ]]; then
-               eval opts=\"${!opts} \
-                       --mkfsoptions='\\\"-O flex_bg -G $NEWSIZE\\\"'\"
-       else
-               val=${!opts//--mkfsoptions=\\\"/ \
-                       --mkfsoptions=\\\"-O flex_bg -G $NEWSIZE }
-               eval opts='${val}'
-       fi
+       [ "$OLDSIZE" == "$NEWSIZE" ] && skip "$NEWSIZE groups already"
 
+       local opts=" -O flex_bg -G $NEWSIZE"
+       opts=$(OST_FS_MKFS_OPTS+="$opts" mkfs_opts ost1 $(ostdevname 1))
+       opts+=" --reformat $(ostdevname 1) $(ostvdevname 1)"
        echo "params: $opts"
 
        trap cleanup_86 EXIT ERR
@@ -6874,7 +6869,7 @@ check_uuid_on_ost() {
 
 check_uuid_on_mdt() {
        local nid=$1
-       do_facet $SINGLEMDS "$LCTL get_param mdt.${FSNAME}*.exports.'$nid'.uuid"
+       do_facet $SINGLEMDS "$LCTL get_param mdt.${mds1_svc}*.exports.'$nid'.uuid"
 }
 
 test_91() {
@@ -6918,6 +6913,7 @@ test_91() {
        echo "evict $nid"
        do_facet $SINGLEMDS \
                "$LCTL set_param -n mdt.${mds1_svc}.evict_client nid:$nid"
+       sleep 1 # eviction above is async, give it some time to proceed
 
        found=$(check_uuid_on_mdt $nid | grep $uuid)
        [ -n "$found" ] && error "found $uuid $nid on MDT"
@@ -7440,7 +7436,7 @@ test_100() {
 }
 run_test 100 "check lshowmount lists MGS, MDT, OST and 0@lo"
 
-test_101() {
+test_101a() {
        local createmany_pid
        local dev=$FSNAME-OST0000-osc-MDT0000
        setup
@@ -7467,7 +7463,29 @@ test_101() {
        unlinkmany $DIR1/$tdir/$tfile-%d 50000
        cleanup
 }
-run_test 101 "Race MDT->OST reconnection with create"
+run_test 101a "Race MDT->OST reconnection with create"
+
+test_101b () {
+       local dev=$FSNAME-OST0000-osc-MDT0000
+       local dir=$DIR1/$tdir
+       setup
+
+       mkdir $dir
+       $LFS setstripe -c 1 -i 0 $dir
+       do_facet $SINGLEMDS "$LCTL --device $dev deactivate;"
+#define OBD_FAIL_OSP_CON_EVENT_DELAY 0x2107
+       do_facet mds1 "$LCTL set_param fail_loc=0x80002107 fail_val=20"
+       do_facet $SINGLEMDS "$LCTL --device $dev activate;"
+       stop_ost
+       sleep 25
+       start_ost
+
+       wait_osc_import_state client ost1 FULL
+       touch $dir/$tfile || error "Can't create file"
+
+       cleanup
+}
+run_test 101b "Race events DISCONNECT and ACTIVE in osp"
 
 test_102() {
        [[ "$MDS1_VERSION" -gt $(version_code 2.9.53) ]] ||
@@ -8431,6 +8449,8 @@ test_112() {
        (( $val == 1 )) || error "obdfilter.$FSNAME-OST0001*.no_precreate=$val"
 
        mount_client $MOUNT || error "mount client failed"
+       wait_osc_import_state mds1 ost1 FULL
+       wait_osc_import_state client ost1 FULL
        wait_osc_import_state client ost2 FULL
 
        $LFS setstripe -i 0 $DIR/$tfile.0 ||
@@ -8442,6 +8462,8 @@ test_112() {
        sleep_maxage
        $LFS setstripe -i 1 $DIR/$tfile.2 ||
                error "failed to create $tfile.2 on ost1 facet"
+       # files not cleaned with ONLY_REPEAT because of client unmount below
+       rm -f $DIR/$tfile.[012]
        stop_ost2 || error "stop ost2 facet failed"
        cleanup
 }
@@ -8562,7 +8584,10 @@ test_116() {
 
        MDSSIZE=$old_mdssize
        MDSISIZE=$old_mdsisize
-       do_facet $SINGLEMDS $MKFS $opts17t $tmpmnt/$mdtimg ||
+
+       do_facet $SINGLEMDS $MKFS \
+               ${opts17t/-E /-E lazy_itable_init,lazy_journal_init,} \
+               $tmpmnt/$mdtimg ||
                error "failed to mkfs for $tmpmnt/$mdtimg"
 
        do_facet $SINGLEMDS $TUNE2FS -l $tmpmnt/$mdtimg |
@@ -8655,11 +8680,15 @@ test_123ab() {
 
        local yaml
        local orig_val
+       local mgs_arg=""
+
+       [[ $MGS_VERSION -gt $(version_code 2.13.54) ]] ||
+               mgs_arg="--device MGS"
 
        orig_val=$(do_facet mgs $LCTL get_param jobid_name)
        do_facet mgs $LCTL set_param -P jobid_name="TESTNAME"
 
-       yaml=$(do_facet mgs $LCTL --device MGS llog_print params |
+       yaml=$(do_facet mgs $LCTL $mgs_arg llog_print params |
               grep jobid_name | tail -n 1)
 
        local param=$(awk '{ print $10 }' <<< "$yaml")
@@ -8678,12 +8707,16 @@ test_123ac() { # LU-11566
 
        local start=10
        local end=50
+       local mgs_arg=""
+
+       [[ $MGS_VERSION -gt $(version_code 2.13.54) ]] ||
+               mgs_arg="--device MGS"
 
        [ -d $MOUNT/.lustre ] || setup
 
        # - { index: 10, event: add_uuid, nid: 192.168.20.1@tcp(0x20000c0a81401,
        #     node: 192.168.20.1@tcp }
-       do_facet mgs $LCTL --device MGS \
+       do_facet mgs $LCTL $mgs_arg \
                llog_print --start $start --end $end $FSNAME-client | tr -d , |
                while read DASH BRACE INDEX idx EVENT BLAH BLAH BLAH; do
                (( idx >= start )) || error "llog_print index $idx < $start"
@@ -8723,26 +8756,30 @@ test_123ae() { # LU-11566
        [ -d $MOUNT/.lustre ] || setupall
 
        local max=$($LCTL get_param -n osc.*-OST0000-*.max_dirty_mb | head -1)
+       local mgs_arg=""
+
+       [[ $MGS_VERSION -gt $(version_code 2.13.54) ]] ||
+               mgs_arg="--device MGS"
 
        if do_facet mgs "$LCTL help llog_cancel" 2>&1| grep -q -- --log_id; then
                # save one set_param -P record in case none exist
                do_facet mgs $LCTL set_param -P osc.*.max_dirty_mb=$max
 
                local log=params
-               local orig=$(do_facet mgs $LCTL --device MGS llog_print $log |
+               local orig=$(do_facet mgs $LCTL $mgs_arg llog_print $log |
                             tail -1 | awk '{ print $4 }' | tr -d , )
                do_facet mgs $LCTL set_param -P osc.*.max_dirty_mb=$max
-               do_facet mgs $LCTL --device MGS llog_print $log | tail -1 |
+               do_facet mgs $LCTL $mgs_arg llog_print $log | tail -1 |
                        grep "parameter: osc.*.max_dirty_mb" ||
                        error "new set_param -P wasn't stored in params log"
 
                # - { index: 71, event: set_param, device: general,
                #     param: osc.*.max_dirty_mb, value: 256 }
-               local id=$(do_facet mgs $LCTL --device MGS llog_print $log |
+               local id=$(do_facet mgs $LCTL $mgs_arg llog_print $log |
                           tail -1 | awk '{ print $4 }' | tr -d , )
 
-               do_facet mgs $LCTL --device MGS llog_cancel $log --log_idx=$id
-               local new=$(do_facet mgs $LCTL --device MGS llog_print $log |
+               do_facet mgs $LCTL $mgs_arg llog_cancel $log --log_idx=$id
+               local new=$(do_facet mgs $LCTL $mgs_arg llog_print $log |
                            tail -1 | awk '{ print $4 }' | tr -d , )
                (( new == orig )) ||
                        error "new llog_cancel now $new, not at $orig records"
@@ -8868,6 +8905,12 @@ test_124()
        [ -z $mds2failover_HOST ] && skip "needs MDT failover setup"
 
        setup
+       do_facet mgs $LCTL --device MGS llog_print $FSNAME-client |
+               grep 1.2.3.4@tcp && error "Should not be fake nid"
+       do_facet mgs $LCTL conf_param $FSNAME-MDT0001.failover.node=1.2.3.4@tcp\
+               || error "Set params error"
+       do_facet mgs $LCTL --device MGS llog_print $FSNAME-client |
+               grep 1.2.3.4@tcp || error "Fake nid should be added"
        cleanup
 
        load_modules
@@ -9006,7 +9049,7 @@ test_125()
 
                echo "Before: ${facet} ${device} ${pre_max_sectors} ${max_hw_sectors}"
 
-               do_facet ${facet} "libtool execute l_tunedisk ${device}"
+               do_facet ${facet} "l_tunedisk ${device}"
 
                # Value after l_tunedisk
                local post_max_sectors=$(get_max_sectors_kb ${facet} ${device})
@@ -9053,6 +9096,72 @@ test_126() {
 }
 run_test 126 "mount in parallel shouldn't cause a crash"
 
+test_127() {
+       [[ "$ost1_FSTYPE" == ldiskfs ]] || skip "ldiskfs only test"
+
+       cleanup
+       setup
+       zconf_umount_clients $RCLIENTS $MOUNT
+
+       wait_osp_active ost ${FSNAME}-OST0000 0 1
+       local osc_tgt="$FSNAME-OST0000-osc-$($LFS getname -i $DIR)"
+       local avail1=($($LCTL get_param -n osc.${osc_tgt}.kbytesavail))
+
+       $LFS setstripe -i 0 $DIR/$tfile || error "failed creating $DIR/$tfile"
+       dd if=/dev/zero of=$DIR/$tfile bs=1M oflag=direct || true
+
+       local avail2=($($LCTL get_param -n osc.${osc_tgt}.kbytesavail))
+
+       if ((avail2 * 100 / avail1 > 1)); then
+               lfs df $DIR
+               ls -l $DIR/$tfile
+               error "more than 1% space left: before=$avail1 after=$avail2"
+       fi
+
+       local mbs=$(($(stat -c %s $DIR/$tfile) / (1024 * 1024)))
+
+       dd if=/dev/zero of=$DIR/$tfile bs=1M count=$mbs conv=notrunc \
+               oflag=direct || error "overwrite failed"
+}
+run_test 127 "direct io overwrite on full ost"
+
+test_128()
+{
+       combined_mgs_mds && skip "need separate mgs device"
+       [ "$ost2_FSTYPE" == zfs ] && import_zpool ost2
+
+       format_ost 2
+       # Try to apply nolocallogs to the virgin OST. Should fail.
+       do_facet ost2 "$TUNEFS --nolocallogs $(ostdevname 2)" &&
+               error "nolocallogs should not be allowed on the virgin target"
+
+       setupall
+       stopall
+
+       [ "$ost1_FSTYPE" == zfs ] && import_zpool ost1
+       # Start OST without MGS (local configs)
+       do_facet ost1 "$TUNEFS --dryrun $(ostdevname 1)"
+       start_ost || error "unable to start OST1"
+       stop_ost || error "Unable to stop OST1"
+
+       [ "$ost1_FSTYPE" == zfs ] && import_zpool ost1
+       # Do not allow reading local configs, should fail
+       do_facet ost1 "$TUNEFS --nolocallogs $(ostdevname 1)" ||
+               error "Can not set nolocallogs"
+       start_ost && error "OST1 started, but should fail"
+
+       # Connect to MGS successfully, reset nolocallogs flag
+       [ "$ost1_FSTYPE" == zfs ] && import_zpool ost1
+       start_mgs || error "unable to start MGS"
+       start_ost || error "unable to start OST1"
+
+       do_facet ost1 "$TUNEFS --dryrun $(ostdevname 1)" | grep "nolocallogs" &&
+               error "nolocallogs expected to be reset"
+
+       stop_ost || error "Unable to stop OST1"
+}
+run_test 128 "Force using remote logs with --nolocallogs"
+
 if ! combined_mgs_mds ; then
        stop mgs
 fi