Whamcloud - gitweb
LU-14637 flr: get rid of excluding dom+flr support test 85/44185/8
authorBobi Jam <bobijam@whamcloud.com>
Thu, 8 Jul 2021 14:34:18 +0000 (22:34 +0800)
committerOleg Drokin <green@whamcloud.com>
Tue, 27 Jul 2021 21:38:22 +0000 (21:38 +0000)
Now that DoM+FLR are supported, fix the tests that expect this
combination of features on a file to fail.

Fixes: 0bff64be320fd ("LU-9771 flr: to not support dom+flr for phase 1")
Fixes: 44a721b8c1063 ("LU-11421 dom: manual OST-to-DOM migration via mirroring)
Signed-off-by: Bobi Jam <bobijam@whamcloud.com>
Change-Id: I9fc76e797e469744107e5d0453b78729226be0ee
Reviewed-on: https://review.whamcloud.com/44185
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Mike Pershin <mpershin@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/tests/sanity-flr.sh
lustre/utils/lfs.c
lustre/utils/liblustreapi_layout.c

index b285468..c00b2e7 100644 (file)
@@ -516,20 +516,21 @@ test_0d() {
        # create a mirrored file and extend it
        $LFS mirror create -N $tf-1 || error "create mirrored file $tf-1 failed"
        $LFS mirror create -N $tf-2 || error "create mirrored file $tf-2 failed"
        # create a mirrored file and extend it
        $LFS mirror create -N $tf-1 || error "create mirrored file $tf-1 failed"
        $LFS mirror create -N $tf-2 || error "create mirrored file $tf-2 failed"
+       $LFS mirror create -N $tf-3 || error "create mirrored file $tf-3 failed"
 
 
-       $mirror_cmd -N -S 4M -N -f $tf-2 $tf-1 &> /dev/null &&
-               error "setstripe options should not be specified with -f option"
+       $mirror_cmd -N -S 4M -N -f $tf-2 $tf-1 ||
+               error "extend mirror with -f failed"
 
 
-       $mirror_cmd -N$((mirror_count - 1)) $tf-1 ||
-               error "extend mirrored file $tf-1 failed"
-       verify_mirror_count $tf-1 $mirror_count
-       ids=($($LFS getstripe $tf-1 | awk '/lcme_id/{print $2}' | tr '\n' ' '))
+       $mirror_cmd -N$((mirror_count - 1)) $tf-3 ||
+               error "extend mirrored file $tf-3 failed"
+       verify_mirror_count $tf-3 $mirror_count
+       ids=($($LFS getstripe $tf-3 | awk '/lcme_id/{print $2}' | tr '\n' ' '))
        for ((i = 0; i < $mirror_count; i++)); do
        for ((i = 0; i < $mirror_count; i++)); do
-               verify_comp_attrs $tf-1 ${ids[$i]}
-               verify_comp_extent $tf-1 ${ids[$i]} 0 EOF
+               verify_comp_attrs $tf-3 ${ids[$i]}
+               verify_comp_extent $tf-3 ${ids[$i]} 0 EOF
        done
 
        done
 
-       $mirror_cmd -N $tf-1 &> /dev/null &&
+       $mirror_cmd -N $tf-3 &> /dev/null &&
                error "exceeded maximum mirror count $mirror_count" || true
 }
 run_test 0d "lfs mirror extend with -N option"
                error "exceeded maximum mirror count $mirror_count" || true
 }
 run_test 0d "lfs mirror extend with -N option"
@@ -934,27 +935,45 @@ test_5() {
 }
 run_test 5 "Make sure init size work for mirrored layout"
 
 }
 run_test 5 "Make sure init size work for mirrored layout"
 
-# LU=10112: disable dom+flr for phase 1
 test_6() {
 test_6() {
+       (( $MDS1_VERSION >= $(version_code 2.12.58) )) ||
+               skip "MDS version older than 2.12.58"
+
        local tf=$DIR/$tfile
 
        local tf=$DIR/$tfile
 
-       $LFS mirror create -N -E 1M -S 1M -L mdt -E eof -N -E eof $tf &&
-               error "expect failure to create mirrored file with DoM"
+       $LFS mirror create -N -E 1M -L mdt -E eof -S 1M -N -E eof $tf ||
+               error "failure to create DoM file with mirror"
 
 
-       $LFS mirror create -N -E 1M -S 1M -E eof -N -E 1M -L mdt -E eof $tf &&
-               error "expect failure to create mirrored file with DoM"
+       $LFS mirror create -N -E 1M -S 1M -E eof -N -E 1M -L mdt -E eof $tf ||
+               error "failure to create mirrored file with DoM"
 
 
-       $LFS setstripe -E 1M -S 1M -L mdt -E eof $tf
-       $LFS mirror extend -N2 $tf &&
-               error "expect failure to extend mirror with DoM"
+       $LFS setstripe -E 1M -L mdt -E eof -S 1M $tf ||
+               error "failure to create PFL with DoM file"
+       $LFS mirror extend -N2 $tf ||
+               error "failure to extend mirror with DoM"
 
 
-       $LFS mirror create -N2 -E 1M -S 1M -E eof $tf-2
-       $LFS mirror extend -N -f $tf $tf-2 &&
-               error "expect failure to extend mirrored file with DoM extent"
+       $LFS setstripe -E 1M -L mdt -E eof -S 1M $tf-1 ||
+               error "failure to create PFL with DoM file"
+       $LFS mirror create -N2 -E 1M -S 1M -E eof $tf-2 ||
+               error "failure to create mirrored file"
+       $LFS mirror extend -N -f $tf-1 $tf-2 ||
+               error "failure to extend mirrored file with DoM extent"
+}
+run_test 6 "DoM and FLR work together"
 
 
-       true
+test_7() {
+       local tf=$DIR/$tfile
+
+       # create DoM with setting stripe_size == component size
+       $LFS mirror create -N -E1M -S1M -L mdt -Eeof $tf ||
+               error "failure to create DoM with stripe_size == comp size"
+       rm -f $tf || error "delete $tf"
+
+       # DoM should not inherit previous component stripe_size
+       $LFS mirror create -N -E4M -S2M -Eeof -N -E1M -L mdt -Eeof $tf ||
+               error "DoM component shouldn't inherit previous stripe_size"
 }
 }
-run_test 6 "DoM and FLR won't co-exist for phase 1"
+run_test 7 "Create mirror with DoM component"
 
 test_21() {
        local tf=$DIR/$tfile
 
 test_21() {
        local tf=$DIR/$tfile
index c124188..2f52650 100644 (file)
@@ -1953,6 +1953,7 @@ static int mirror_extend_layout(char *name, struct llapi_layout *m_layout,
        if (inherit) {
                f_layout = llapi_layout_get_by_path(name, 0);
                if (!f_layout) {
        if (inherit) {
                f_layout = llapi_layout_get_by_path(name, 0);
                if (!f_layout) {
+                       rc = -EINVAL;
                        fprintf(stderr, "%s: cannot get layout\n", progname);
                        goto out;
                }
                        fprintf(stderr, "%s: cannot get layout\n", progname);
                        goto out;
                }
@@ -2037,11 +2038,7 @@ out:
 static int mirror_extend(char *fname, struct mirror_args *mirror_list,
                         enum mirror_flags mirror_flags)
 {
 static int mirror_extend(char *fname, struct mirror_args *mirror_list,
                         enum mirror_flags mirror_flags)
 {
-       int rc;
-
-       rc = mirror_create_sanity_check(fname, mirror_list, true);
-       if (rc)
-               return rc;
+       int rc = 0;
 
        while (mirror_list) {
                if (mirror_list->m_file) {
 
        while (mirror_list) {
                if (mirror_list->m_file) {
@@ -2837,7 +2834,8 @@ new_comp:
                        errno = EINVAL;
                        return -1;
                }
                        errno = EINVAL;
                        return -1;
                }
-               if (lsa->lsa_stripe_size != LLAPI_LAYOUT_DEFAULT) {
+               if (lsa->lsa_stripe_size != LLAPI_LAYOUT_DEFAULT &&
+                   lsa->lsa_stripe_size != lsa->lsa_comp_end - prev_end) {
                        fprintf(stderr,
                                "Option 'stripe-size' can't be specified with Data-on-MDT component: %llu\n",
                                lsa->lsa_stripe_size);
                        fprintf(stderr,
                                "Option 'stripe-size' can't be specified with Data-on-MDT component: %llu\n",
                                lsa->lsa_stripe_size);
@@ -3909,6 +3907,7 @@ static int lfs_setstripe_internal(int argc, char **argv,
                                        goto error;
                                }
                                lsa.lsa_pattern = LLAPI_LAYOUT_MDT;
                                        goto error;
                                }
                                lsa.lsa_pattern = LLAPI_LAYOUT_MDT;
+                               lsa.lsa_stripe_size = LLAPI_LAYOUT_DEFAULT;
                        } else if (strcmp(argv[optind - 1], "raid0") != 0) {
                                result = -EINVAL;
                                fprintf(stderr,
                        } else if (strcmp(argv[optind - 1], "raid0") != 0) {
                                result = -EINVAL;
                                fprintf(stderr,
index aca20cc..f4d6587 100644 (file)
@@ -2756,7 +2756,9 @@ int llapi_layout_mirror_inherit(struct llapi_layout *f_layout,
        if (m_comp == NULL)
                return -EINVAL;
 
        if (m_comp == NULL)
                return -EINVAL;
 
-       m_comp->llc_stripe_size = f_comp->llc_stripe_size;
+       /* DoM component does not inherit stripe size */
+       if (m_comp->llc_pattern != LLAPI_LAYOUT_MDT)
+               m_comp->llc_stripe_size = f_comp->llc_stripe_size;
        m_comp->llc_stripe_count = f_comp->llc_stripe_count;
 
        return rc;
        m_comp->llc_stripe_count = f_comp->llc_stripe_count;
 
        return rc;