Whamcloud - gitweb
LU-11773 utils: add PFL flags support to YAML API 54/34454/3
authorPatrick Farrell <paf@cray.com>
Thu, 13 Dec 2018 20:21:31 +0000 (14:21 -0600)
committerOleg Drokin <green@whamcloud.com>
Mon, 1 Apr 2019 06:19:13 +0000 (06:19 +0000)
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>
lustre/tests/sanity-flr.sh
lustre/tests/sanity-pfl.sh
lustre/tests/test-framework.sh
lustre/utils/lfs.c

index e046061..8217251 100644 (file)
@@ -1820,7 +1820,7 @@ test_44() {
 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
@@ -1832,16 +1832,14 @@ test_45() {
                -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"
 
index f78bc3f..f7ca7ef 100644 (file)
@@ -639,25 +639,6 @@ test_15() {
 }
 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"
 
@@ -674,7 +655,7 @@ test_16() {
                $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
@@ -684,7 +665,7 @@ test_16() {
 
        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
@@ -695,7 +676,7 @@ test_16() {
 
        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
@@ -703,7 +684,7 @@ test_16() {
        $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"
 
index 25f4f83..72a24ec 100755 (executable)
@@ -9376,3 +9376,23 @@ save_layout_restore_at_exit() {
 
        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"
+}
+
index f42cdf4..be687d1 100644 (file)
@@ -2286,6 +2286,16 @@ static int build_layout_from_yaml_node(struct cYAML *node,
                                } 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")) {