summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunaid <junaid@gluster.com>2011-07-04 00:47:55 +0000
committerAnand Avati <avati@gluster.com>2011-07-14 06:39:47 -0700
commit53a11db91a34718778aea4123dc1fa69287d39ec (patch)
tree05fb3aca88210d595cfe55c09f172f0a63afb598
parent6d71641ca56e53eb8e988b4e5c1676eb782503c3 (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 794eab017..0e480a5eb 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -1308,12 +1308,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++;
}
@@ -1431,7 +1439,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)