summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunaid <junaid@gluster.com>2011-06-14 03:28:59 +0000
committerAnand Avati <avati@gluster.com>2011-06-14 09:04:27 -0700
commit1f14a1fccd5a8eed92936d9910d4b9a45ca1b56c (patch)
treedff3fa7acfb7d081c918abdaf9a744ae8accfcd0
parent6ae674eef777fda74191e2186d95778b9d5671f3 (diff)
cli: 'QUOTA' Display the limit-set and size of the directory in KB, MB, etc
Signed-off-by: Junaid <junaid@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 2829 (Display the quota limit as it is configured) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2829
-rw-r--r--cli/src/cli-rpc-ops.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index 382e1110cc1..bca4c1ac227 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -1310,12 +1310,13 @@ out:
}
int32_t
-print_limit_list (char *volname, char *limit_list)
+gf_cli3_1_print_limit_list (char *volname, char *limit_list)
{
int64_t size = 0;
int64_t limit_value = 0;
int32_t i, j, k;
int32_t len = 0, ret = -1;
+ char *size_str = NULL;
char path [PATH_MAX] = {0, };
char ret_str [1024] = {0, };
char value [1024] = {0, };
@@ -1382,8 +1383,15 @@ print_limit_list (char *volname, char *limit_list)
} else {
sscanf (ret_str, "%"PRId64",%"PRId64, &size,
&limit_value);
- cli_out ("%-20s %10"PRId64" %20"PRId64, path,
- limit_value, size);
+ size_str = gf_uint64_2human_readable ((uint64_t) size);
+ if (size_str == NULL) {
+ cli_out ("%-20s %10s %20"PRId64, path,
+ value, size);
+ } else {
+ cli_out ("%-20s %10s %20s", path,
+ value, size_str);
+ GF_FREE (size_str);
+ }
}
i++;
}
@@ -1432,7 +1440,8 @@ gf_cli3_1_quota_cbk (struct rpc_req *req, struct iovec *iov,
if (rsp.type == GF_QUOTA_OPTION_TYPE_LIST) {
if (rsp.limit_list)
- print_limit_list (rsp.volname, rsp.limit_list);
+ gf_cli3_1_print_limit_list (rsp.volname,
+ rsp.limit_list);
} else {
gf_log ("cli", GF_LOG_INFO, "Received resp to quota command ");
if (rsp.op_errstr)