From 1c6cc68314f4badaa6555e58bb5a79f389c0d2ab Mon Sep 17 00:00:00 2001 From: Sergey Cheremencev Date: Tue, 13 May 2025 17:53:38 +0300 Subject: [PATCH] LU-19011 utils: lfs quota -a -u --busage has delimiter lfs quota all should insert a delimiter between the name and certain parameter(busage, bhardlimit, bsoftlimit ...). Fixes: 7c02893e12 ("LU-18079 utils: argument parse opts for lfs quota") Signed-off-by: Sergey Cheremencev Change-Id: Icace5752c4a169858792748c5f4b41e336d18cac Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/59209 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Frederick Dilger Reviewed-by: Oleg Drokin --- lustre/tests/sanity-quota.sh | 16 ++++++++++++++-- lustre/utils/lfs.c | 3 ++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/lustre/tests/sanity-quota.sh b/lustre/tests/sanity-quota.sh index 9ca1757..088cfea 100755 --- a/lustre/tests/sanity-quota.sh +++ b/lustre/tests/sanity-quota.sh @@ -4215,7 +4215,7 @@ test_get_allquota() { unlinkmany ${TFILE} $qid_cnt } -test_49() +test_49a() { (( MDS1_VERSION >= $(version_code 2.15.60) )) || skip "Need MDS version at least 2.15.60" @@ -4274,7 +4274,19 @@ test_49() formatall setupall } -run_test 49 "lfs quota -a prints the quota usage for all quota IDs" +run_test 49a "lfs quota -a prints the quota usage for all quota IDs" + +test_49b() { + local root_name + + (( MDS1_VERSION >= $(version_code v2_15_61-145-g3edc718) )) || + skip "Need MDS version >= 2.15.61 for lfs quota all support" + + root_name=$($LFS quota -a -u --busage $DIR | awk '/root/ {print $1}') + # check username is not merged with the usage + [[ $root_name == "root" ]] || error "root name is insane: $root_name" +} +run_test 49b "lfs quota -a --blocks has a delimiter" test_50() { ! is_project_quota_supported && diff --git a/lustre/utils/lfs.c b/lustre/utils/lfs.c index 4c88774..abe3e23 100644 --- a/lustre/utils/lfs.c +++ b/lustre/utils/lfs.c @@ -9287,7 +9287,8 @@ static void diff2str(time_t seconds, char *buf, time_t now) static void print_quota_val(char *val, int cols, bool print_over, struct quota_param *param) { - if ((param->qp_detail & (param->qp_detail - 1)) == 0) /* single value */ + if ((param->qp_detail & (param->qp_detail - 1)) == 0 && + !param->qp_show_qid) /* single value */ printf("%s", val); else if (param->qp_delim[0]) printf("%*s%s", cols, val, param->qp_delim); -- 1.8.3.1