From 694665046f3bef84b66483c7a06f72d2c259e39e Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Tue, 7 Sep 2021 11:46:15 -0600 Subject: [PATCH] EX-3750 tests: fix hot-pools and sanity-lipe merges Restore missing changes in lustre/tests/hot-pools and .../sanity-lipe. These were not included in the lipe/ subtree merge since they were outside that dir. Fix hot-pools test_4 to scan the lamigo log on the MDS. Add tests for lipe_scan2 Test-Parameters: trivial testlist=hot-pools,sanity-lipe Fixes: 2f05a3e06928 ("EX-2453 lipe: fixup striped directory paths") Fixes: 3eee8554c0fb ("EX-2453 lipe: add SoM handling to lipe_scan2") Fixes: fa19bceb68e0 ("EX-1325 lamigo: improve debug/error messages") Signed-off-by: Andreas Dilger Change-Id: I4c34a3a8f48edf81b5231d208f1a0ff3d9a811f8 Reviewed-on: https://review.whamcloud.com/44859 Reviewed-by: Jian Yu Tested-by: jenkins Tested-by: Maloo --- lustre/tests/hot-pools.sh | 7 +++- lustre/tests/sanity-lipe.sh | 97 ++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 101 insertions(+), 3 deletions(-) diff --git a/lustre/tests/hot-pools.sh b/lustre/tests/hot-pools.sh index 5cee666..d9db469 100644 --- a/lustre/tests/hot-pools.sh +++ b/lustre/tests/hot-pools.sh @@ -1058,7 +1058,8 @@ test_4() { check_one_lamigo_is_started || error "failed to start lamigo" stack_trap stop_one_lamigo_cfg - grep -q "unknown tunable: $unknown_param" $log_file || + do_facet $facet "cat $log_file" | + grep -q "unknown tunable: $unknown_param" || error "failed to recognize unknown parameter '$unknown_param'" LAMIGO_THREAD_NUM=2 LAMIGO_PROG_INTV=300 \ @@ -1728,8 +1729,10 @@ test_56() { $cmd || error "$LFS setstripe $tf-3 failed" # fill in data - yes "1M file"| dd bs=1M count=1 iflag=fullblock of=$tf-3 || + yes "1M file"| dd bs=1M count=1 iflag=fullblock of=$tf-3 || { + $LFS getstripe $tf-3 error "failed to write to $tf-3" + } cancel_lru_locks sync; sleep 5; sync $LFS mirror resync $tf-3 || error "failed to resync $tf-3" diff --git a/lustre/tests/sanity-lipe.sh b/lustre/tests/sanity-lipe.sh index 3197c1b..8ff932f 100644 --- a/lustre/tests/sanity-lipe.sh +++ b/lustre/tests/sanity-lipe.sh @@ -28,11 +28,13 @@ ALWAYS_EXCEPT="$SANITY_LIPE_EXCEPT " ! remote_ost_nodsh || skip_env "remote OSS with nodsh" # check if lipe_find and lipe_scan are installed on MDS(s) -for t in lipe_find lipe_scan; do +for t in lipe_find lipe_scan lipe_scan2; do do_nodes $(comma_list $(all_mdts_nodes)) "which $t" &>/dev/null || skip_env "$t is not installed on MDS" done +which jq || skip_env "jq is not installed" + # lipe_find configuration LIPE_FIND="lipe_find" LIPE_FIND_LOG_DIR=${LIPE_FIND_LOG_DIR:-"/var/log/lipe_find"} @@ -1337,6 +1339,99 @@ test_23() { } run_test 23 "lipe_find -size and -blocks work" +do_lipe_scan2_facet() { + local facet="$1" + local device="$(facet_device $facet)" + shift + + do_facet "$facet" lipe_scan2 "$device" "$@" +} + +lipe_scan2_mount_client() { + local nodes + + # All MDT nodes except the current node. + nodes=$(all_mdts_nodes | grep --fixed-strings --line-regexp --invert-match "$HOSTNAME") + if [[ -z "$nodes" ]]; then + return + fi + + zconf_mount_clients "$(comma_list $nodes)" "$MOUNT" || + error "failed to mount Lustre clients on MDS nodes" + stack_trap "zconf_umount_clients $(comma_list $nodes) $MOUNT" +} + +test_200() { + local file=$DIR/$tdir/$tfile + local fid + local attrs + local size1 + local size2 + local blocks1 + local blocks2 + local flags1 + local flags2 + + mkdir -p $DIR/$tdir || error "mkdir $DIR/$tdir failed" + echo XXX > $file + fid=$($LFS path2fid $file) + + sync + sync_all_data + sync + cancel_lru_locks mdc + + $LFS getsom $file + flags1=$($LFS getsom -f $file) + size1=$($LFS getsom -s $file) + blocks1=$($LFS getsom -b $file) + + attrs=$(do_lipe_scan2_facet mds1 --print-json=fid,som | + jq --arg FID "$fid" 'select(.fid == $FID)') + echo "attrs = '$attrs'" >&2 + + flags2=$(jq --null-input "$attrs.som._flags") + size2=$(jq --null-input "$attrs.som.size") + blocks2=$(jq --null-input "$attrs.som.blocks") + + ((flags1 == flags2)) || error "flags1 ($flags1) != flags2 ($flags2)" + ((size1 == size2)) || error "size1 ($size1) != size2 ($size2)" + ((blocks1 == blocks2)) || error "blocks1 ($blocks1) != blocks2 ($blocks2)" +} +run_test 200 "lipe_scan2 SoM support" + +test_201() { + local file0=$DIR/$tdir/$tfile + local file1=$DIR/$tdir.2/$tfile.2 + local fid + local -a path + local path_count + + mkdir -p $DIR/$tdir $DIR/$tdir.2 || error "mkdir $DIR/$tdir failed" + echo XXX > $file0 + fid=$($LFS path2fid $file0) + ln $file0 $file1 + + sync + sync_all_data + sync + cancel_lru_locks mdc + + lipe_scan2_mount_client + + attrs=$(do_lipe_scan2_facet mds1 --client-mount="$MOUNT" --print-json=fid,paths | + jq --arg FID "$fid" 'select(.fid == $FID)') + echo "attrs = '$attrs'" >&2 + + path_count=$(jq --null-input "$attrs.paths | length") + ((path_count == 2)) || error "path_count ($path_count) != 2" + + path=( $(jq --null-input --raw-output "$attrs.paths[]") ) + [[ "${path[0]}" == "$tdir/$tfile" ]] || error "path0 '${path[0]}' != '$tdir/$tfile'" + [[ "${path[1]}" == "$tdir.2/$tfile.2" ]] || error "path1 '${path[1]}' != '$tdir.2/$tfile.2'" +} +run_test 201 "lipe_scan2 paths support" + complete $SECONDS check_and_cleanup_lustre exit_status -- 1.8.3.1