The setstripe YAML interface currently ignores the
lcme_flags field. This means it doesn't work correctly with
some FLR layouts.
Fixing this is a trivial matter of making the YAML layout
generator read & use the lcme_flags field.
Lustre-change: https://review.whamcloud.com/33852
Lustre-commit:
b71766311daa0faf3560a2435778f7b2de1e3ad6
Signed-off-by: Patrick Farrell <paf@cray.com>
Change-Id: If15999aa58ac3e31da677bd5d1ef8b063b46b1e5
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Signed-off-by: Minh Diep <mdiep@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/34454
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
run_test 44 "lfs mirror split check"
test_45() {
- [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
+ [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
local file=$DIR/$tdir/$tfile
local dir=$DIR/$tdir/$dir
-N -E3m -S1m -Eeof -N -E8m -Eeof $file ||
error "Create $file failed"
- echo "getstripe --yaml $file"
- $LFS getstripe --yaml $file > $temp || error "getstripe $file failed"
- echo "setstripe --yaml=$temp $file.2"
- $LFS setstripe --yaml=$temp $file.2 || error "setstripe $file.2 failed"
+ verify_yaml_layout $file $file.copy $temp "1. FLR file"
+ rm -f $file $file.copy
- echo "compare layout"
- local layout1=$(get_layout_param $file)
- local layout2=$(get_layout_param $file.2)
- [ "$layout1" == "$layout2" ] ||
- error "FLR file $file/$file.2 layouts are not equal"
+ $LFS setstripe -N -E1m -S1m -c2 -o0,1 -E2m -Eeof -N -E4m -Eeof \
+ -N -E3m -S1m -Eeof -N -E8m --flags=prefer -Eeof $file ||
+ error "Create $file failed"
+
+ verify_yaml_layout $file $file.copy $temp "2. FLR file with flags"
}
run_test 45 "Verify setstripe/getstripe with YAML with FLR file"
}
run_test 15 "Verify component options for lfs find"
-verify_16() {
- local src=$1
- local dst=$2
- local temp=$3
- local msg_prefix=$4
-
- echo "getstripe --yaml $src"
- $LFS getstripe --yaml $src > $temp || error "getstripe $src failed"
- echo "setstripe --yaml=$temp $dst"
- $LFS setstripe --yaml=$temp $dst|| error "setstripe $dst failed"
-
- echo "compare"
- local layout1=$(get_layout_param $src)
- local layout2=$(get_layout_param $dst)
- # compare their layout info
- [ "$layout1" == "$layout2" ] ||
- error "$msg_prefix $src/$dst layouts are not equal"
-}
-
test_16() {
[ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
$file || error "Create $file failed"
echo "1. PFL file"
- verify_16 $file $file.copy $temp "1. PFL file"
+ verify_yaml_layout $file $file.copy $temp "1. PFL file"
#####################################################################
# 2. plain file
rm -f $file.copy
echo "2. plain file"
- verify_16 $file $file.copy $temp "2. plain file"
+ verify_yaml_layout $file $file.copy $temp "2. plain file"
#####################################################################
# 3. PFL dir
test_mkdir $dir.copy
echo "3. PFL dir"
- verify_16 $dir $dir.copy $temp.dir "3. PFL dir"
+ verify_yaml_layout $dir $dir.copy $temp.dir "3. PFL dir"
#####################################################################
# 4. plain dir
$LFS setstripe -c2 -i-1 $dir || error "setstripe $dir failed"
echo "4. plain dir"
- verify_16 $dir $dir.copy $temp.dir "4. plain dir"
+ verify_yaml_layout $dir $dir.copy $temp.dir "4. plain dir"
}
run_test 16 "Verify setstripe/getstripe with YAML config file"
stack_trap "restore_layout $dir $layout" EXIT
}
+
+verify_yaml_layout() {
+ local src=$1
+ local dst=$2
+ local temp=$3
+ local msg_prefix=$4
+
+ echo "getstripe --yaml $src"
+ $LFS getstripe --yaml $src > $temp || error "getstripe $src failed"
+ echo "setstripe --yaml=$temp $dst"
+ $LFS setstripe --yaml=$temp $dst|| error "setstripe $dst failed"
+
+ echo "compare"
+ local layout1=$(get_layout_param $src)
+ local layout2=$(get_layout_param $dst)
+ # compare their layout info
+ [ "$layout1" == "$layout2" ] ||
+ error "$msg_prefix $src/$dst layouts are not equal"
+}
+
} else if (!strcmp(string, "pattern")) {
if (!strcmp(node->cy_valuestring, "mdt"))
lsa->lsa_pattern = LLAPI_LAYOUT_MDT;
+ } else if (!strcmp(string, "lcme_flags")) {
+ rc = comp_str2flags(node->cy_valuestring,
+ &lsa->lsa_comp_flags,
+ &lsa->lsa_comp_neg_flags);
+ if (rc)
+ return rc;
+ /* Only template flags have meaning in
+ * the layout for a new file
+ */
+ lsa->lsa_comp_flags &= LCME_TEMPLATE_FLAGS;
}
} else if (node->cy_type == CYAML_TYPE_NUMBER) {
if (!strcmp(string, "lcm_mirror_count")) {