Whamcloud - gitweb
LU-17685 utils: Allow nocompr flag in lfs mirror extend 40/54640/4
authorAlexandre Ioffe <aioffe@ddn.com>
Sat, 30 Mar 2024 20:55:24 +0000 (13:55 -0700)
committerOleg Drokin <green@whamcloud.com>
Mon, 8 Apr 2024 15:39:29 +0000 (15:39 +0000)
Extend the set of allowed optional flags in
'lfs mirror extend' command by LCME_FL_NOCOMPR. Allowed syntax:
--flags=prefer
--flags=nocompr
--flags=prefer,nocompr

Test-Parameters: trivial testlist=sanity-flr
Signed-off-by: Alexandre Ioffe <aioffe@ddn.com>
Change-Id: Id1538182eca0142464c19c0c4b1406592e615be1
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/54640
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Artem Blagodarenko <ablagodarenko@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/uapi/linux/lustre/lustre_user.h
lustre/tests/sanity-flr.sh
lustre/utils/liblustreapi_layout.c

index 60f14b4..376c622 100644 (file)
@@ -937,7 +937,7 @@ enum lov_comp_md_entry_flags {
                                 LCME_FL_EXTENSION)
 
 /* The mirror flags can be set by users at creation time. */
-#define LCME_USER_MIRROR_FLAGS (LCME_FL_PREF_RW)
+#define LCME_USER_MIRROR_FLAGS (LCME_FL_PREF_RW | LCME_FL_NOCOMPR)
 
 /* The allowed flags obtained from the client at component creation time. */
 #define LCME_CL_COMP_FLAGS     (LCME_USER_MIRROR_FLAGS | LCME_FL_EXTENSION)
index 9c6c2cb..f570187 100644 (file)
@@ -4132,12 +4132,26 @@ function test_205() {
 
        $LFS mirror extend -N --flags=prefer $tf
        mirrors=$($LFS getstripe $tf | grep lcme_mirror_id | wc -l )
-       (( $mirrors == 3 )) || error "no new mirror was created?"
+       (( $mirrors == 3 )) || error "no new mirror with prefer flag was created?"
 
        $($LFS getstripe $tf | grep lcme_flags: | tail -1 | grep -q prefer) ||
                error "prefer flag was not set on the new mirror"
+
+       $LFS mirror extend -N --flags=nocompr $tf
+       mirrors=$($LFS getstripe $tf | grep lcme_mirror_id | wc -l )
+       (( $mirrors == 4 )) || error "no new mirror with nocompr flag was created?"
+
+       $($LFS getstripe $tf | grep lcme_flags: | tail -1 | grep -q nocompr) ||
+               error "nocompr flag was not set on the new mirror"
+
+       $LFS mirror extend -N --flags=prefer,nocompr $tf
+       mirrors=$($LFS getstripe $tf | grep lcme_mirror_id | wc -l )
+       (( $mirrors == 5 )) || error "no new mirror with prefer,nocompr flags was created?"
+
+       $($LFS getstripe $tf | grep lcme_flags: | tail -1 | grep -q "prefer,nocompr") ||
+               error "prefer,nocompr flags were not set on the new mirror"
 }
-run_test 205 "lfs mirror extend to set prefer flag"
+run_test 205 "lfs mirror extend to set prefer and nocompr flags"
 
 function test_206() {
        # create a new OST pool
index da74518..332af24 100644 (file)
@@ -3642,7 +3642,8 @@ static int llapi_layout_sanity_cb(struct llapi_layout *layout,
                                args->lsa_rc = LSE_FLAGS;
                } else {
                        if (comp->llc_flags &
-                           ~(LCME_FL_EXTENSION | LCME_FL_PREF_RW))
+                           ~(LCME_FL_EXTENSION | LCME_FL_PREF_RW |
+                             LCME_FL_NOCOMPR))
                                args->lsa_rc = LSE_FLAGS;
                }
        }