summaryrefslogtreecommitdiffstats
path: root/cli/src/cli-rpc-ops.c
diff options
context:
space:
mode:
Diffstat (limited to 'cli/src/cli-rpc-ops.c')
-rw-r--r--cli/src/cli-rpc-ops.c36
1 files changed, 9 insertions, 27 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index a1977397..ae31ddef 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -2687,7 +2687,6 @@ gf_cli_quota_cbk (struct rpc_req *req, struct iovec *iov,
char *volname = NULL;
char *limit_list = NULL;
int32_t type = 0;
- char msg[5120] = {0,};
call_frame_t *frame = NULL;
uint32_t op_version = 1;
char *default_sl = NULL;
@@ -2706,15 +2705,14 @@ gf_cli_quota_cbk (struct rpc_req *req, struct iovec *iov,
goto out;
}
- if (rsp.op_ret &&
- strcmp (rsp.op_errstr, "") == 0) {
- snprintf (msg, sizeof (msg), "command unsuccessful %s",
- rsp.op_errstr);
+ if (rsp.op_ret && strcmp (rsp.op_errstr, "") == 0) {
+ cli_err ("quota command : failed");
if (global_state->mode & GLUSTER_MODE_XML)
goto xml_output;
goto out;
- }
+ } else if (strcmp (rsp.op_errstr, ""))
+ cli_err ("quota command failed : %s", rsp.op_errstr);
if (rsp.dict.dict_len) {
/* Unserialize the dictionary */
@@ -2731,6 +2729,8 @@ gf_cli_quota_cbk (struct rpc_req *req, struct iovec *iov,
}
}
+ gf_log ("cli", GF_LOG_DEBUG, "Received resp to quota command");
+
ret = dict_get_str (dict, "volname", &volname);
if (ret)
gf_log (frame->this->name, GF_LOG_TRACE,
@@ -2789,25 +2789,11 @@ gf_cli_quota_cbk (struct rpc_req *req, struct iovec *iov,
gf_cli_quota_list_run_crawler (volname, limit_list, dict, count,
rsp.op_errstr, op_version,
default_sl, entry_count);
- if (rsp.op_errstr)
- snprintf (msg, sizeof (msg)-1, "%s", rsp.op_errstr);
- }
-
- gf_log ("cli", GF_LOG_DEBUG, "Received resp to quota command");
-
- if (rsp.op_errstr) {
- snprintf (msg, sizeof (msg)-1, "%s", rsp.op_errstr);
- } else {
- if (!rsp.op_ret)
- snprintf (msg, sizeof (msg)-1, "Quota command "
- "successful");
- else
- snprintf (msg, sizeof (msg)-1, "Quota command failed");
}
xml_output:
if (global_state->mode & GLUSTER_MODE_XML) {
- ret = cli_xml_output_str ("volQuota", msg, rsp.op_ret,
+ ret = cli_xml_output_str ("volQuota", NULL, rsp.op_ret,
rsp.op_errno, rsp.op_errstr);
if (ret)
gf_log ("cli", GF_LOG_ERROR,
@@ -2815,12 +2801,8 @@ xml_output:
goto out;
}
- if (strlen (msg) > 0) {
- if (rsp.op_ret)
- cli_err ("%s", msg);
- else
- cli_out ("%s", msg);
- }
+ if (!rsp.op_ret && type != GF_QUOTA_OPTION_TYPE_LIST)
+ cli_out ("volume quota : success");
ret = rsp.op_ret;
out: