Whamcloud - gitweb
EX-4539 lipe: add -pool to lipe_find3
authorJohn L. Hammond <jhammond@whamcloud.com>
Tue, 22 Feb 2022 15:43:28 +0000 (09:43 -0600)
committerJohn L. Hammond <jhammond@whamcloud.com>
Thu, 10 Mar 2022 17:26:16 +0000 (17:26 +0000)
Add a -pool test to lipe_find3. Add sanity-lipe-find3 test_110() to
verify.

Test-Parameters: trivial testlist=sanity-lipe-find3
Signed-off-by: John L. Hammond <jhammond@whamcloud.com>
Change-Id: I9649d7f80431d22223da17372ec4d64fa6ca2f37
Reviewed-on: https://review.whamcloud.com/46584
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lipe/src/lipe_find3/lf3_lexer.l
lipe/src/lipe_find3/lf3_parse.y
lustre/tests/sanity-lipe-find3.sh

index 8cf3003..a7f40c9 100644 (file)
@@ -59,7 +59,7 @@ static int expr_arg_type;
        return TOKEN_TEST;
 }
 
--(amin|atime|cmin|ctime|gid|group|iname|inum|links|mmin|mtime|name|path|perm|projid|size|type|uid|user)\0 {
+-(amin|atime|cmin|ctime|gid|group|iname|inum|links|mmin|mtime|name|path|perm|pool|projid|size|type|uid|user)\0 {
        LF3_DEBUG("unary '%s'\n", yytext);
        expr_arg_begin = lf3_arg_index;
        expr_arg_end = lf3_arg_index + 2;
index 448eec7..1927258 100644 (file)
@@ -713,6 +713,13 @@ static char *lf3_ipath_expr(int begin, int end)
        return lf3_fnmatch_expr(LF3_FNMATCH_CI, lf3_arg[begin + 1], "call-with-relative-path");
 }
 
+static char *lf3_pool_expr(int begin, int end)
+{
+       assert(begin + 2 == end);
+
+       return xsprintf("(member %Q (lov-pools))", lf3_arg[begin + 1]);
+}
+
 static char *lf3_exec_plus_expr(int begin, int end)
 {
        char *expr = NULL;
@@ -1072,6 +1079,7 @@ static char *lf3_simple_expr(int begin, int end)
        X1(type);
        X1(exec);
        X1(perm);
+       X1(pool);
        // X1(used); TODO
        X1(print);
        X1(print0);
index ec5f818..e703056 100644 (file)
@@ -674,6 +674,37 @@ test_109() {
 }
 run_test 109 "lipe_find3 -path and -ipath do the right thing"
 
+test_110() {
+       local file=$MOUNT/$tfile
+       local fid
+       local pool=$TESTNAME
+
+       pool_add "$pool" || error "cannot add pool '$pool'"
+       pool_add_targets "$pool" 0 || error "cannot add OST 0 to '$pool'"
+
+       init_lipe_find3_env
+       $LFS setstripe -c1 -p "$pool" "$file"
+       echo XXX > "$file"
+       fid=$($LFS path2fid "$file")
+
+       expect1 "$fid" lipe_find3_facet mds1 -pool "$pool"
+       expect_empty lipe_find3_facet mds1 -pool ""
+       expect_empty lipe_find3_facet mds1 -pool quux
+
+       rm "$file"
+       echo XXX > "$file"
+       fid=$($LFS path2fid "$file")
+
+       expect1 "$fid" lipe_find3_facet mds1 \! -pool "$pool"
+       expect_empty lipe_find3_facet mds1 -pool ""
+
+       # We do not validate user supplied pool names in lipe_find3 or
+       # lipe_scan3. This is because it is possible for LOV xattrs to
+       # contain pool that no longer exist.
+       expect_error lipe_find3_facet mds1 -pool
+}
+run_test 110 "lipe_find3 -pool does the right thing"
+
 test_130() {
        local file=$MOUNT/$tfile
        local xtime