diff options
author | Manikandan Selvaganesh <mselvaga@redhat.com> | 2015-10-13 14:28:03 +0530 |
---|---|---|
committer | Kaushal M <kaushal@redhat.com> | 2015-10-14 00:07:34 -0700 |
commit | 00eeb153f4ea473c6636147f6c72c04336128198 (patch) | |
tree | fe2901755082dd558b1365de9234fa8fa60a59d7 | |
parent | a2976a2eb8c79cbec1009bec4c420b4874da25bc (diff) |
cli/quota : rm -rf on /<mountpoint>/<dir> is not showing quota header
Currently, when 'gluster v quota <VOLNAME> list' command is issued
after an rm -rf on /run/gluster/vol/<directory>, quota output header is
not shown. It is because the list_count was properly calculated with
'gluster v quota <VOLNAME> remove /path' and not with an rm -rf. The patch
fixes this issue.
Change-Id: I5266a8b0b9322b7db1b9e1d6b0327065931f4bcb
BUG: 1269375
Signed-off-by: Manikandan Selvaganesh <mselvaga@redhat.com>
Reviewed-on: http://review.gluster.org/12345
Reviewed-by: Vijaikumar Mallikarjuna <vmallika@redhat.com>
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaushal M <kaushal@redhat.com>
-rw-r--r-- | cli/src/cli-rpc-ops.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index a322d61d9a5..553a94a219a 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -3233,8 +3233,7 @@ out: } int -print_quota_list_from_quotad (call_frame_t *frame, dict_t *rsp_dict, - int32_t list_count) +print_quota_list_from_quotad (call_frame_t *frame, dict_t *rsp_dict) { char *path = NULL; char *default_sl = NULL; @@ -3245,6 +3244,7 @@ print_quota_list_from_quotad (call_frame_t *frame, dict_t *rsp_dict, quota_limits_t limits = {0, }; quota_limits_t *size_limits = NULL; int32_t type = 0; + int32_t success_count = 0; GF_ASSERT (frame); @@ -3308,7 +3308,25 @@ print_quota_list_from_quotad (call_frame_t *frame, dict_t *rsp_dict, goto out; } - if (list_count == 0) { + LOCK (&local->lock); + { + ret = dict_get_int32 (gd_rsp_dict, "quota-list-success-count", + &success_count); + if (ret) + success_count = 0; + + ret = dict_set_int32 (gd_rsp_dict, + "quota-list-success-count", + success_count + 1); + } + UNLOCK (&local->lock); + if (ret) { + gf_log ("cli", GF_LOG_ERROR, "Failed to set " + "quota-list-success-count in dict"); + goto out; + } + + if (success_count == 0) { if (!(global_state->mode & GLUSTER_MODE_XML)) { print_quota_list_header (type); } else { @@ -3413,7 +3431,8 @@ cli_quotad_getlimit_cbk (struct rpc_req *req, struct iovec *iov, "unserialize req-buffer to dictionary"); goto out; } - print_quota_list_from_quotad (frame, dict, list_count); + + print_quota_list_from_quotad (frame, dict); } out: |