Whamcloud - gitweb
LU-19011 utils: lfs quota -a -u --busage has delimiter 09/59209/4
authorSergey Cheremencev <scherementsev@ddn.com>
Tue, 13 May 2025 14:53:38 +0000 (17:53 +0300)
committerOleg Drokin <green@whamcloud.com>
Sat, 7 Jun 2025 23:02:48 +0000 (23:02 +0000)
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 <scherementsev@ddn.com>
Change-Id: Icace5752c4a169858792748c5f4b41e336d18cac
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/59209
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Frederick Dilger <fdilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/sanity-quota.sh
lustre/utils/lfs.c

index 9ca1757..088cfea 100755 (executable)
@@ -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 &&
index 4c88774..abe3e23 100644 (file)
@@ -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);