From 6b6fde1026311a28595ea43af56392ca6ad24d79 Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Wed, 19 May 2021 01:44:32 -0600 Subject: [PATCH 1/1] LU-13055 libcfs: allow comma-separated masks 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 Change-Id: Icf1e3ebc74f0e48b38a65486b2275ec4c33ebbe5 Reviewed-on: https://review.whamcloud.com/43741 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Emoly Liu Reviewed-by: Mike Pershin Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- libcfs/libcfs/libcfs_string.c | 7 ++++--- lustre/tests/sanity-quota.sh | 6 ++++-- lustre/tests/test-framework.sh | 8 ++++---- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/libcfs/libcfs/libcfs_string.c b/libcfs/libcfs/libcfs_string.c index fa32e37..5549417 100644 --- a/libcfs/libcfs/libcfs_string.c +++ b/libcfs/libcfs/libcfs_string.c @@ -48,14 +48,14 @@ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit), int newmask = minmask, i, len, found = 0; ENTRY; - /* must be a list of tokens separated by whitespace + /* must be a list of tokens separated by whitespace or comma, * and optionally an operator ('+' or '-'). If an operator * appears first in , '*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; diff --git a/lustre/tests/sanity-quota.sh b/lustre/tests/sanity-quota.sh index b110d54..89552fd 100755 --- a/lustre/tests/sanity-quota.sh +++ b/lustre/tests/sanity-quota.sh @@ -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 diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index de9c121..bf06109 100755 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -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 } -- 1.8.3.1