Whamcloud - gitweb
LU-8040 mgc: Apply changelog defaults values in mdd_init0()
[fs/lustre-release.git] / lustre / tests / conf-sanity.sh
index 7a6d88e..48252bf 100755 (executable)
@@ -86,8 +86,9 @@ init_logging
 #
 require_dsh_mds || exit 0
 require_dsh_ost || exit 0
-#
-[ "$SLOW" = "no" ] && EXCEPT_SLOW="30a 31 45 69"
+
+#                                  8  22   (min)"
+[ "$SLOW" = "no" ] && EXCEPT_SLOW="45 69"
 
 assert_DIR
 
@@ -2992,7 +2993,7 @@ test_43a() {
        [ $UID -ne 0 -o $RUNAS_ID -eq 0 ] && skip_env "run as root"
 
        ID1=${ID1:-501}
-       USER1=$(cat /etc/passwd | grep :$ID1:$ID1: | cut -d: -f1)
+       USER1=$(getent passwd | grep :$ID1:$ID1: | cut -d: -f1)
        [ -z "$USER1" ] && skip_env "missing user with uid=$ID1 gid=$ID1" &&
                return
 
@@ -3198,8 +3199,8 @@ test_45() { #17310
        df -h $MOUNT &
        log "sleep 60 sec"
        sleep 60
-       #define OBD_FAIL_PTLRPC_LONG_UNLINK   0x50f
-       do_facet client "$LCTL set_param fail_loc=0x50f"
+#define OBD_FAIL_PTLRPC_LONG_REPL_UNLINK   0x50f
+       do_facet client "$LCTL set_param fail_loc=0x50f fail_val=0"
        log "sleep 10 sec"
        sleep 10
        manual_umount_client --force || error "manual_umount_client failed"
@@ -3811,9 +3812,9 @@ test_52() {
        echo
 
        # backup files
-       echo backup files to $TMP/files
+       echo backup files to $TMP/$tdir
        local files=$(find $DIR/$tdir -type f -newer $TMP/modified_first)
-       copy_files_xattrs $(hostname) $TMP/files $TMP/file_xattrs $files ||
+       copy_files_xattrs $(hostname) $TMP/$tdir $TMP/file_xattrs $files ||
                error "Unable to copy files"
 
        umount_client $MOUNT || error "Unable to umount client"
@@ -3853,10 +3854,10 @@ test_52() {
                error "Some entry under /lost+found should be repaired"
 
        # compare files
-       diff_files_xattrs $(hostname) $TMP/files $TMP/file_xattrs $files ||
+       diff_files_xattrs $(hostname) $TMP/$tdir $TMP/file_xattrs $files ||
                error "Unable to diff files"
 
-       rm -rf $TMP/files $TMP/file_xattrs ||
+       rm -rf $TMP/$tdir $TMP/file_xattrs ||
                error "Unable to delete temporary files"
        do_node $ost1node "rm -rf $ost1tmp" ||
                error "Unable to delete temporary files"
@@ -5116,6 +5117,28 @@ test_76b() { # LU-4783
 }
 run_test 76b "verify params log setup correctly"
 
+test_76c() {
+       [[ $(lustre_version_code mgs) -ge $(version_code 2.8.54) ]] ||
+               { skip "Need MDS version at least 2.4.52" && return 0; }
+       setupall
+       local MASK_PARAM="mdd.*.changelog_mask"
+       echo "Change changelog_mask"
+       do_facet mgs $LCTL set_param -P $MASK_PARAM=-CLOSE ||
+               error "Can't change changlog_mask"
+       wait_update $(facet_host mds) "$LCTL get_param -n $MASK_PARAM |
+               grep 'CLOSE'" ""
+
+       echo "Check the value is stored after mds remount"
+       stop_mds || error "Failed to stop MDS"
+       start_mds || error "Failed to start MDS"
+       local CHANGELOG_MASK=$(do_facet mgs $LCTL get_param -n $MASK_PARAM)
+       echo $CHANGELOG_MASK | grep CLOSE > /dev/null &&
+               error "changelog_mask is not changed"
+
+       stopall
+}
+run_test 76c "verify changelog_mask is applied with set_param -P"
+
 test_77() { # LU-3445
        local server_version=$(lustre_version_code $SINGLEMDS)
 
@@ -5163,8 +5186,12 @@ test_78() {
                skip "only applicable to ldiskfs-based MDTs and OSTs" && return
 
        # reformat the Lustre filesystem with a smaller size
+       local saved_MDSCOUNT=$MDSCOUNT
        local saved_MDSSIZE=$MDSSIZE
+       local saved_OSTCOUNT=$OSTCOUNT
        local saved_OSTSIZE=$OSTSIZE
+       MDSCOUNT=1
+       OSTCOUNT=1
        MDSSIZE=$((MDSSIZE - 20000))
        OSTSIZE=$((OSTSIZE - 20000))
        reformat || error "(1) reformat Lustre filesystem failed"
@@ -5179,11 +5206,26 @@ test_78() {
        local i
        local file
        local num_files=100
+
        mkdir $MOUNT/$tdir || error "(3) mkdir $MOUNT/$tdir failed"
+       $LFS df; $LFS df -i
        for i in $(seq $num_files); do
                file=$MOUNT/$tdir/$tfile-$i
-               dd if=/dev/urandom of=$file count=1 bs=1M ||
+               dd if=/dev/urandom of=$file count=1 bs=1M || {
+                       $LCTL get_param osc.*.cur*grant*
+                       $LFS df; $LFS df -i;
+                       # stop creating files if there is no more space
+                       if [ ! -e $file ]; then
+                               num_files=$((i - 1))
+                               break
+                       fi
+
+                       $LFS getstripe -v $file
+                       local ost_idx=$(LFS getstripe -i $file)
+                       do_facet ost$((ost_idx + 1)) \
+                               $LCTL get_param obdfilter.*.*grant*
                        error "(4) create $file failed"
+               }
        done
 
        # unmount the Lustre filesystem
@@ -5295,6 +5337,9 @@ test_78() {
        # unmount and reformat the Lustre filesystem
        cleanup || error "(12) cleanup Lustre filesystem failed"
        combined_mgs_mds || stop_mgs || error "(13) stop mgs failed"
+
+       MDSCOUNT=$saved_MDSCOUNT
+       OSTCOUNT=$saved_OSTCOUNT
        reformat || error "(14) reformat Lustre filesystem failed"
 }
 run_test 78 "run resize2fs on MDT and OST filesystems"
@@ -6293,6 +6338,140 @@ test_91() {
 }
 run_test 91 "evict-by-nid support"
 
+generate_ldev_conf() {
+       # generate an ldev.conf file
+       local ldevconfpath=$1
+       touch $ldevconfpath
+       printf "%s\t-\t%s-MGS0000\t%s\n" \
+               $mgs_HOST \
+               $FSNAME \
+               $(mgsdevname) >> $ldevconfpath
+
+       local mdsfo_host=$mdsfailover_HOST;
+       if [ -z "$mdsfo_host" ]; then
+               mdsfo_host="-"
+       fi
+
+       for num in $(seq $MDSCOUNT); do
+               printf "%s\t%s\t%s-MDT%04d\t%s\n" \
+                       $mds_HOST \
+                       $mdsfo_host \
+                       $FSNAME \
+                       $num \
+                       $(mdsdevname $num) >> $ldevconfpath
+       done
+
+       local ostfo_host=$ostfailover_HOST;
+       if [ -z "$ostfo_host" ]; then
+               ostfo_host="-"
+       fi
+
+       for num in $(seq $OSTCOUNT); do
+               printf "%s\t%s\t%s-OST%04d\t%s\n" \
+                       $ost_HOST \
+                       $ostfo_host \
+                       $FSNAME \
+                       $num \
+                       $(ostdevname $num) >> $ldevconfpath
+       done
+}
+
+generate_nids() {
+       # generate a nids file (mapping between hostname to nid)
+       # looks like we only have the MGS nid available to us
+       # so just echo that to a file
+       local nidspath=$1
+       touch $nidspath
+       echo -e "${mgs_HOST}\t${MGSNID}" >> $nidspath
+}
+
+test_92() {
+       local LDEVCONFPATH=$TMP/ldev.conf
+       local NIDSPATH=$TMP/nids
+
+       echo "Host is $(hostname)"
+
+       generate_ldev_conf $LDEVCONFPATH
+       generate_nids $NIDSPATH
+
+       echo "----- ldev.conf -----"
+       cat $LDEVCONFPATH
+       echo "--- END ldev.conf ---"
+
+       echo "----- /etc/nids -----"
+       cat $NIDSPATH
+       echo "--- END /etc/nids ---"
+
+       # ldev can be in our build tree and if we aren't in a
+       # build tree, use 'which' to try and find it
+       local LDEV=$LUSTRE/scripts/ldev
+       [ ! -f "$LDEV" ] && local LDEV=$(which ldev 2> /dev/null)
+
+       echo "ldev path is $LDEV"
+
+       if [ ! -f "$LDEV" ]; then
+               rm $LDEVCONFPATH $NIDSPATH
+               error "failed to find ldev!"
+       fi
+
+       # echo the mgs nid and compare it to environment variable MGSNID
+       # also, ldev.conf and nids is a server side thing, use the OSS
+       # hostname
+       local output
+       output=$(perl $LDEV -c $LDEVCONFPATH -H \
+                       $ost_HOST -n $NIDSPATH echo %m)
+
+       echo "-- START OF LDEV OUTPUT --"
+       echo -e "$output"
+       echo "--- END OF LDEV OUTPUT ---"
+
+       # ldev failed, error
+       if [ $? -ne 0 ]; then
+               rm $LDEVCONFPATH $NIDSPATH
+               error "ldev failed to execute!"
+       fi
+
+       # need to process multiple lines because of combined MGS and MDS
+       echo -e $output | awk '{ print $2 }' | while read -r line ; do
+               if [ "$line" != "$MGSNID" ]; then
+                       rm $LDEVCONFPATH $NIDSPATH
+                       error "ldev failed mgs nid '$line', expected '$MGSNID'"
+               fi
+       done
+
+       rm $LDEVCONFPATH $NIDSPATH
+}
+run_test 92 "ldev returns MGS NID correctly in command substitution"
+
+test_93() {
+       [ $MDSCOUNT -lt 3 ] && skip "needs >= 3 MDTs" && return
+
+       reformat
+       #start mgs or mgs/mdt0
+       if ! combined_mgs_mds ; then
+               start_mgs
+               start_mdt 1
+       else
+               start_mdt 1
+       fi
+
+       start_ost || error "OST0 start fail"
+
+       #define OBD_FAIL_MGS_WRITE_TARGET_DELAY  0x90e
+       do_facet mgs "$LCTL set_param fail_val = 10 fail_loc=0x8000090e"
+       for num in $(seq 2 $MDSCOUNT); do
+               start_mdt $num &
+       done
+
+       mount_client $MOUNT || error "mount client fails"
+       wait_osc_import_state mds ost FULL
+       wait_osc_import_state client ost FULL
+       check_mount || error "check_mount failed"
+
+       cleanup || error "cleanup failed with $?"
+}
+run_test 93 "register mulitple MDT at the same time"
+
 if ! combined_mgs_mds ; then
        stop mgs
 fi