summaryrefslogtreecommitdiffstats
path: root/cli/src/cli-rpc-ops.c
diff options
context:
space:
mode:
authorVenky Shankar <venky@gluster.com>2011-04-25 03:10:01 +0000
committerAnand Avati <avati@gluster.com>2011-05-20 11:01:49 -0700
commit2cd8411a0278f98ed820aad3e482de079d0540c0 (patch)
tree66cd9fa15fe8d269277b41469c3f45a12f59c24b /cli/src/cli-rpc-ops.c
parent03c58c782d99440a5947289d0ff216bca8ef7c57 (diff)
cli log level command and per translator log level
Signed-off-by: Venky Shankar <venky@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 2714 (implement cli log level command) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2714
Diffstat (limited to 'cli/src/cli-rpc-ops.c')
-rw-r--r--cli/src/cli-rpc-ops.c69
1 files changed, 69 insertions, 0 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c
index 1a2c4ee94ed..83abb865bcb 100644
--- a/cli/src/cli-rpc-ops.c
+++ b/cli/src/cli-rpc-ops.c
@@ -2277,6 +2277,74 @@ out:
return ret;
}
+static int
+gf_cli3_1_log_level_cbk (struct rpc_req *req, struct iovec *iov,
+ int count, void *myframe)
+{
+ gf1_cli_log_level_rsp rsp = {0,};
+ int ret = -1;
+
+ if (req->rpc_status == -1)
+ goto out;
+
+ ret = gf_xdr_to_cli_log_level_rsp (*iov, &rsp);
+ if (ret < 0) {
+ gf_log ("cli", GF_LOG_ERROR, "log level response error");
+ goto out;
+ }
+
+ gf_log ("cli", GF_LOG_DEBUG, "Received response to log level cmd");
+
+ if (rsp.op_ret && strcmp (rsp.op_errstr, ""))
+ cli_out (rsp.op_errstr);
+ else
+ cli_out ("log level set: %s", (rsp.op_ret) ? "unsuccessful" :
+ "successful");
+
+ ret = rsp.op_ret;
+
+ out:
+ cli_cmd_broadcast_response (ret);
+ return ret;
+}
+
+int32_t
+gf_cli3_1_log_level (call_frame_t *frame, xlator_t *this,
+ void *data)
+{
+ gf1_cli_log_level_req req = {0,};
+ int ret = 0;
+ dict_t *dict = NULL;
+
+ if (!frame || !this || !data) {
+ ret = -1;
+ goto out;
+ }
+
+ dict = data;
+
+ ret = dict_get_str (dict, "volname", &req.volname);
+ if (ret)
+ goto out;
+
+ ret = dict_get_str (dict, "xlator", &req.xlator);
+ if (ret)
+ goto out;
+
+ ret = dict_get_str (dict, "loglevel", &req.loglevel);
+ if (ret)
+ goto out;
+
+ ret = cli_cmd_submit (&req, frame, cli_rpc_prog,
+ GLUSTER_CLI_LOG_LEVEL, NULL,
+ gf_xdr_from_cli_log_level_req,
+ this, gf_cli3_1_log_level_cbk);
+
+ out:
+ gf_log ("cli", GF_LOG_DEBUG, "Returning: %d", ret);
+ return ret;
+}
+
int32_t
gf_cli3_1_log_locate (call_frame_t *frame, xlator_t *this,
@@ -3429,6 +3497,7 @@ struct rpc_clnt_procedure gluster_cli_actors[GLUSTER_CLI_MAXVALUE] = {
[GLUSTER_CLI_PROFILE_VOLUME] = {"PROFILE_VOLUME", gf_cli3_1_profile_volume},
[GLUSTER_CLI_QUOTA] = {"QUOTA", gf_cli3_1_quota},
[GLUSTER_CLI_TOP_VOLUME] = {"TOP_VOLUME", gf_cli3_1_top_volume},
+ [GLUSTER_CLI_LOG_LEVEL] = {"VOLUME_LOGLEVEL", gf_cli3_1_log_level},
[GLUSTER_CLI_GETWD] = {"GETWD", gf_cli3_1_getwd}
};