summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorManikandan Selvaganesh <mselvaga@redhat.com>2015-07-30 18:29:41 +0530
committerRaghavendra G <rgowdapp@redhat.com>2015-08-26 05:09:47 -0700
commit7f346e567edb94b008a5f0fa9f614fa8a296636b (patch)
tree4fe84ae46f35b06ccd14fb7885bfb987a0939eda /cli
parent9d71c362b11544494b3fe68477cc47abe3bb2cde (diff)
quota :display the size of soft limit percentage
Display the size equivalent to the soft limit percentage in gluster v quota <volname> list <path> and gluster v quota <volname> list-objects <path> command Backport of http://review.gluster.org/#/c/11808/ Cherry picked from commit b9e87f39386fc9c591c7698357c2899afc255b95 > Change-Id: I31ee82e9e836068348cf9458dcaf13f043d9fd87 > BUG: 1248521 > Signed-off-by: Manikandan Selvaganesh <mselvaga@redhat.com> > Reviewed-on: http://review.gluster.org/11808 > Tested-by: NetBSD Build System <jenkins@build.gluster.org> > Reviewed-by: Vijaikumar Mallikarjuna <vmallika@redhat.com> > Reviewed-by: Raghavendra G <rgowdapp@redhat.com> Change-Id: I31ee82e9e836068348cf9458dcaf13f043d9fd87 BUG: 1255644 Signed-off-by: Manikandan Selvaganesh <mselvaga@redhat.com> Reviewed-on: http://review.gluster.org/11977 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'cli')
-rw-r--r--cli/src/cli-rpc-ops.c27
-rw-r--r--cli/src/cli.c10
2 files changed, 21 insertions, 16 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index dfc5c6b1781..c27573f89da 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -2925,17 +2925,20 @@ static int
print_quota_list_usage_output (cli_local_t *local, char *path, int64_t avail,
char *sl_str, quota_limits_t *limits,
quota_meta_t *used_space, gf_boolean_t sl,
- gf_boolean_t hl)
+ gf_boolean_t hl, double sl_num)
{
int32_t ret = -1;
char *used_str = NULL;
char *avail_str = NULL;
char *hl_str = NULL;
+ char *sl_val = NULL;
hl_str = gf_uint64_2human_readable (limits->hl);
used_str = gf_uint64_2human_readable (used_space->size);
avail_str = gf_uint64_2human_readable (avail);
+ sl_val = gf_uint64_2human_readable (sl_num);
+
if (global_state->mode & GLUSTER_MODE_XML) {
ret = cli_quota_xml_output (local, path, hl_str,
sl_str, used_str,
@@ -2950,12 +2953,12 @@ print_quota_list_usage_output (cli_local_t *local, char *path, int64_t avail,
}
if (!used_str) {
- cli_out ("%-40s %7s %9s %11"PRIu64 "%9"PRIu64" %15s %18s",
- path, hl_str, sl_str, used_space->size, avail,
+ cli_out ("%-40s %7s %7s(%s) %8"PRIu64 "%9"PRIu64" %15s %18s",
+ path, hl_str, sl_str, sl_val, used_space->size, avail,
sl ? "Yes" : "No", hl ? "Yes" : "No");
} else {
- cli_out ("%-40s %7s %9s %11s %7s %15s %20s", path, hl_str,
- sl_str, used_str, avail_str, sl ? "Yes" : "No",
+ cli_out ("%-40s %7s %7s(%s) %8s %7s %15s %20s", path, hl_str,
+ sl_str, sl_val, used_str, avail_str, sl ? "Yes" : "No",
hl ? "Yes" : "No");
}
@@ -2972,9 +2975,10 @@ static int
print_quota_list_object_output (cli_local_t *local, char *path, int64_t avail,
char *sl_str, quota_limits_t *limits,
quota_meta_t *used_space, gf_boolean_t sl,
- gf_boolean_t hl)
+ gf_boolean_t hl, double sl_num)
{
int32_t ret = -1;
+ int64_t sl_val = sl_num;
if (global_state->mode & GLUSTER_MODE_XML) {
ret = cli_quota_object_xml_output (local, path, sl_str, limits,
@@ -2989,8 +2993,8 @@ print_quota_list_object_output (cli_local_t *local, char *path, int64_t avail,
goto out;
}
- cli_out ("%-40s %9"PRIu64" %9s %10"PRIu64" %10"PRIu64" %11"PRIu64
- " %15s %20s", path, limits->hl, sl_str,
+ cli_out ("%-40s %9"PRIu64" %9s(%"PRId64") %10"PRIu64" %10"PRIu64
+ "%11"PRIu64" %15s %20s", path, limits->hl, sl_str, sl_val,
used_space->file_count, used_space->dir_count,
avail, sl ? "Yes" : "No", hl ? "Yes" : "No");
@@ -3028,7 +3032,6 @@ print_quota_list_output (cli_local_t *local, char *path, char *default_sl,
limits->sl);
sl_final = percent_str;
}
-
if (type == GF_QUOTA_OPTION_TYPE_LIST)
used_size = used_space->size;
else
@@ -3049,11 +3052,13 @@ print_quota_list_output (cli_local_t *local, char *path, char *default_sl,
if (type == GF_QUOTA_OPTION_TYPE_LIST)
ret = print_quota_list_usage_output (local, path, avail,
sl_final, limits,
- used_space, sl, hl);
+ used_space, sl, hl,
+ sl_num);
else
ret = print_quota_list_object_output (local, path, avail,
sl_final, limits,
- used_space, sl, hl);
+ used_space, sl, hl,
+ sl_num);
return ret;
}
diff --git a/cli/src/cli.c b/cli/src/cli.c
index 5256e43e9d3..e3cef2e4236 100644
--- a/cli/src/cli.c
+++ b/cli/src/cli.c
@@ -763,18 +763,18 @@ print_quota_list_header (int type)
{
if (type == GF_QUOTA_OPTION_TYPE_LIST) {
cli_out (" Path Hard-limit "
- "Soft-limit Used Available Soft-limit exceeded?"
- " Hard-limit exceeded?");
+ " Soft-limit Used Available Soft-limit "
+ "exceeded? Hard-limit exceeded?");
cli_out ("-----------------------------------------------------"
"-----------------------------------------------------"
- "-----------------");
+ "---------------------");
} else {
cli_out (" Path Hard-limit "
- "Soft-limit Files Dirs Available "
+ " Soft-limit Files Dirs Available "
"Soft-limit exceeded? Hard-limit exceeded?");
cli_out ("-----------------------------------------------------"
"-----------------------------------------------------"
- "-----------------------------------");
+ "-------------------------------------");
}
}