Whamcloud - gitweb
LU-13055 libcfs: allow comma-separated masks 41/43741/4
authorAndreas Dilger <adilger@whamcloud.com>
Wed, 19 May 2021 07:44:32 +0000 (01:44 -0600)
committerOleg Drokin <green@whamcloud.com>
Wed, 2 Jun 2021 17:49:26 +0000 (17:49 +0000)
For debug and changelog mask names, allow a comma-separated list
of names to be given, so that the space-separated list does not
need to be quoted for use.

Change sanity-quota to use a comma-separated list to verify it works.

Fix a couple of test cases where the debug parameter is set and
printed overly verbosely during tests.

Test-Parameters: trivial testlist=sanity-quota
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: Icf1e3ebc74f0e48b38a65486b2275ec4c33ebbe5
Reviewed-on: https://review.whamcloud.com/43741
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Emoly Liu <emoly@whamcloud.com>
Reviewed-by: Mike Pershin <mpershin@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
libcfs/libcfs/libcfs_string.c
lustre/tests/sanity-quota.sh
lustre/tests/test-framework.sh

index fa32e37..5549417 100644 (file)
@@ -48,14 +48,14 @@ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit),
        int newmask = minmask, i, len, found = 0;
 
        ENTRY;
-       /* <str> must be a list of tokens separated by whitespace
+       /* <str> must be a list of tokens separated by whitespace or comma,
         * and optionally an operator ('+' or '-').  If an operator
         * appears first in <str>, '*oldmask' is used as the starting point
         * (relative), otherwise minmask is used (absolute).  An operator
         * applies to all following tokens up to the next operator.
         */
        while (*str != 0) {
-               while (isspace(*str))
+               while (isspace(*str) || *str == ',')
                        str++;
                if (*str == 0)
                        break;
@@ -72,7 +72,8 @@ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit),
 
                /* find token length */
                for (len = 0; str[len] != 0 && !isspace(str[len]) &&
-                    str[len] != '+' && str[len] != '-'; len++);
+                       str[len] != '+' && str[len] != '-' && str[len] != ',';
+                    len++);
 
                /* match token */
                found = 0;
index b110d54..89552fd 100755 (executable)
@@ -490,7 +490,8 @@ reset_quota_settings() {
 
 # enable quota debug
 quota_init() {
-       do_nodes $(comma_list $(nodes_list)) "lctl set_param debug=+quota+trace"
+       do_nodes $(comma_list $(nodes_list)) \
+               "$LCTL set_param -n debug=+quota,trace"
 }
 quota_init
 reset_quota_settings
@@ -4863,7 +4864,8 @@ run_test 73 "default limits at OST Pool Quotas"
 
 quota_fini()
 {
-       do_nodes $(comma_list $(nodes_list)) "lctl set_param debug=-quota"
+       do_nodes $(comma_list $(nodes_list)) \
+               "lctl set_param -n debug=-quota,trace"
        if $PQ_CLEANUP; then
                disable_project_quota
        fi
index de9c121..bf06109 100755 (executable)
@@ -10308,12 +10308,12 @@ function createmany() {
                local saved_debug=$($LCTL get_param -n debug)
                local list=$(comma_list $(all_nodes))
 
-               do_nodes $list $LCTL set_param debug=0
+               do_nodes $list $LCTL set_param -n debug=0
        }
        $LUSTRE/tests/createmany $*
        local rc=$?
        (( count > 100 )) &&
-               do_nodes $list "$LCTL set_param debug=\\\"$saved_debug\\\""
+               do_nodes $list "$LCTL set_param -n debug=\\\"$saved_debug\\\""
        return $rc
 }
 
@@ -10324,12 +10324,12 @@ function unlinkmany() {
                local saved_debug=$($LCTL get_param -n debug)
                local list=$(comma_list $(all_nodes))
 
-               do_nodes $list $LCTL set_param debug=0
+               do_nodes $list $LCTL set_param -n debug=0
        }
        $LUSTRE/tests/unlinkmany $*
        local rc=$?
        (( count > 100 )) &&
-               do_nodes $list "$LCTL set_param debug=\\\"$saved_debug\\\""
+               do_nodes $list "$LCTL set_param -n debug=\\\"$saved_debug\\\""
        return $rc
 }