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 \
$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"
! 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"}
}
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