diff options
author | Amar Tumballi <amar@gluster.com> | 2011-11-13 00:18:32 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2011-11-16 01:45:24 -0800 |
commit | a29ab15988f46fbe98151c37676185de970fb187 (patch) | |
tree | 7e768d2fdcfca5e1f1a26b524c2acfb700067d15 /cli | |
parent | 7a97478dd1a343fcc5d9d4eab963882191a3de69 (diff) |
glusterd/cli: rpc cleanup
no more backward compatibility between glusterd <-> glusterd
Change-Id: Ibfcca1c7e315a90b2639c4cba8da19b11875051a
BUG: 3158
Reviewed-on: http://review.gluster.com/610
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Shishir Gowda <shishirng@gluster.com>
Reviewed-by: Krishnan Parthasarathi <kp@gluster.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'cli')
-rw-r--r-- | cli/src/cli-cmd-volume.c | 130 | ||||
-rw-r--r-- | cli/src/cli-rpc-ops.c | 203 |
2 files changed, 1 insertions, 332 deletions
diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c index 8d3ff557ab7..18d17b4546d 100644 --- a/cli/src/cli-cmd-volume.c +++ b/cli/src/cli-cmd-volume.c @@ -1152,50 +1152,6 @@ cli_cmd_volume_set_transport_cbk (struct cli_state *state, } int -cli_cmd_log_filename_cbk (struct cli_state *state, struct cli_cmd_word *word, - const char **words, int wordcount) -{ - int ret = -1; - rpc_clnt_procedure_t *proc = NULL; - call_frame_t *frame = NULL; - dict_t *options = NULL; - int sent = 0; - int parse_error = 0; - - if (!((wordcount == 5) || (wordcount == 6))) { - cli_usage_out (word->pattern); - parse_error = 1; - goto out; - } - - proc = &cli_rpc_prog->proctable[GLUSTER_CLI_LOG_FILENAME]; - - frame = create_frame (THIS, THIS->ctx->pool); - if (!frame) - goto out; - - ret = cli_cmd_log_filename_parse (words, wordcount, &options); - if (ret) - goto out; - - if (proc->fn) { - ret = proc->fn (frame, THIS, options); - } - -out: - if (options) - dict_destroy (options); - - if (ret) { - cli_cmd_sent_status_get (&sent); - if ((sent == 0) && (parse_error == 0)) - cli_out ("Volume log filename failed"); - } - - return ret; -} - -int cli_cmd_volume_top_cbk (struct cli_state *state, struct cli_cmd_word *word, const char **words, int wordcount) { @@ -1239,49 +1195,6 @@ out: } -int -cli_cmd_log_locate_cbk (struct cli_state *state, struct cli_cmd_word *word, - const char **words, int wordcount) -{ - int ret = -1; - rpc_clnt_procedure_t *proc = NULL; - call_frame_t *frame = NULL; - dict_t *options = NULL; - int sent = 0; - int parse_error = 0; - - if (!((wordcount == 4) || (wordcount == 5))) { - cli_usage_out (word->pattern); - parse_error = 1; - goto out; - } - - proc = &cli_rpc_prog->proctable[GLUSTER_CLI_LOG_LOCATE]; - - frame = create_frame (THIS, THIS->ctx->pool); - if (!frame) - goto out; - - ret = cli_cmd_log_locate_parse (words, wordcount, &options); - if (ret) - goto out; - - if (proc->fn) { - ret = proc->fn (frame, THIS, options); - } - -out: - if (options) - dict_destroy (options); - - if (ret) { - cli_cmd_sent_status_get (&sent); - if ((sent == 0) && (parse_error == 0)) - cli_out ("getting log file location information failed"); - } - - return ret; -} int cli_cmd_log_rotate_cbk (struct cli_state *state, struct cli_cmd_word *word, @@ -1430,37 +1343,6 @@ out: } int -cli_cmd_log_level_cbk (struct cli_state *state, struct cli_cmd_word *word, - const char **words, int wordcount) -{ - int ret = -1; - rpc_clnt_procedure_t *proc = NULL; - call_frame_t *frame = NULL; - dict_t *dict = NULL; - - if (wordcount != 6) { - cli_usage_out (word->pattern); - goto out; - } - - proc = &cli_rpc_prog->proctable[GLUSTER_CLI_LOG_LEVEL]; - - frame = create_frame (THIS, THIS->ctx->pool); - if (!frame) - goto out; - - ret = cli_cmd_log_level_parse (words, wordcount, &dict); - if (ret) - goto out; - - if (proc->fn) - ret = proc->fn (frame, THIS, dict); - - out: - return ret; -} - -int cli_cmd_volume_status_cbk (struct cli_state *state, struct cli_cmd_word *word, const char **words, int wordcount) @@ -1695,14 +1577,6 @@ struct cli_cmd volume_cmds[] = { cli_cmd_volume_help_cbk, "display help for the volume command"}, - { "volume log filename <VOLNAME> [BRICK] <PATH>", - cli_cmd_log_filename_cbk, - "set the log file for corresponding volume/brick"}, - - { "volume log locate <VOLNAME> [BRICK]", - cli_cmd_log_locate_cbk, - "locate the log file for corresponding volume/brick"}, - { "volume log rotate <VOLNAME> [BRICK]", cli_cmd_log_rotate_cbk, "rotate the log file for corresponding volume/brick"}, @@ -1736,10 +1610,6 @@ struct cli_cmd volume_cmds[] = { cli_cmd_volume_top_cbk, "volume top operations"}, - {"volume log level <VOLNAME> <XLATOR[*]> <LOGLEVEL>", - cli_cmd_log_level_cbk, - "log level for translator"}, - { "volume status <VOLNAME>", cli_cmd_volume_status_cbk, "display status of specified volume"}, diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index bcaf0cef593..9007d373469 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -1470,66 +1470,6 @@ out: return ret; } -static int -gf_cli3_1_log_filename_cbk (struct rpc_req *req, struct iovec *iov, - int count, void *myframe) -{ - gf_cli_rsp rsp = {0,}; - int ret = -1; - - if (-1 == req->rpc_status) { - goto out; - } - - ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_cli_rsp); - if (ret < 0) { - gf_log ("", GF_LOG_ERROR, "error"); - goto out; - } - - gf_log ("cli", GF_LOG_DEBUG, "Received resp to log filename"); - - if (rsp.op_ret && strcmp (rsp.op_errstr, "")) - cli_out ("%s", rsp.op_errstr); - else - cli_out ("log filename : %s", - (rsp.op_ret) ? "unsuccessful": "successful"); - - ret = rsp.op_ret; - -out: - cli_cmd_broadcast_response (ret); - if (rsp.dict.dict_val) - free (rsp.dict.dict_val); - return ret; -} - -static int -gf_cli3_1_log_locate_cbk (struct rpc_req *req, struct iovec *iov, - int count, void *myframe) -{ - gf1_cli_log_locate_rsp rsp = {0,}; - int ret = -1; - - if (-1 == req->rpc_status) { - goto out; - } - - ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf1_cli_log_locate_rsp); - if (ret < 0) { - gf_log ("", GF_LOG_ERROR, "error"); - goto out; - } - - gf_log ("cli", GF_LOG_DEBUG, "Received resp to log locate"); - cli_out ("log file location: %s", rsp.path); - - ret = rsp.op_ret; - -out: - cli_cmd_broadcast_response (ret); - return ret; -} static int gf_cli3_1_log_rotate_cbk (struct rpc_req *req, struct iovec *iov, @@ -2690,144 +2630,6 @@ out: return ret; } -int32_t -gf_cli3_1_log_filename (call_frame_t *frame, xlator_t *this, - void *data) -{ - gf_cli_req req = {{0,}}; - int ret = 0; - dict_t *dict = NULL; - - if (!frame || !this || !data) { - ret = -1; - goto out; - } - - dict = data; - - ret = dict_allocate_and_serialize (dict, - &req.dict.dict_val, - (size_t *)&req.dict.dict_len); - if (ret < 0) { - gf_log (THIS->name, GF_LOG_ERROR, "failed to serialize dict"); - goto out; - } - - ret = cli_cmd_submit (&req, frame, cli_rpc_prog, - GLUSTER_CLI_LOG_FILENAME, NULL, - this, gf_cli3_1_log_filename_cbk, - (xdrproc_t) xdr_gf_cli_req); - -out: - gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); - - if (req.dict.dict_val) - GF_FREE (req.dict.dict_val); - - return ret; -} - -static int -gf_cli3_1_log_level_cbk (struct rpc_req *req, struct iovec *iov, - int count, void *myframe) -{ - gf_cli_rsp rsp = {0,}; - int ret = -1; - - if (req->rpc_status == -1) - goto out; - - ret = xdr_to_generic (*iov, &rsp, (xdrproc_t)xdr_gf_cli_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 ("%s", 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) -{ - gf_cli_req req = {{0,}}; - int ret = 0; - dict_t *dict = NULL; - - if (!frame || !this || !data) { - ret = -1; - goto out; - } - - dict = data; - - ret = dict_allocate_and_serialize (dict, - &req.dict.dict_val, - (size_t *)&req.dict.dict_len); - if (ret < 0) { - gf_log (THIS->name, GF_LOG_ERROR, "failed to serialize dict"); - goto out; - } - - ret = cli_cmd_submit (&req, frame, cli_rpc_prog, - GLUSTER_CLI_LOG_LEVEL, NULL, - this, gf_cli3_1_log_level_cbk, - (xdrproc_t) xdr_gf_cli_req); - - out: - gf_log ("cli", GF_LOG_DEBUG, "Returning: %d", ret); - - if (req.dict.dict_val) - GF_FREE (req.dict.dict_val); - return ret; -} - - -int32_t -gf_cli3_1_log_locate (call_frame_t *frame, xlator_t *this, - void *data) -{ - gf1_cli_log_locate_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, "brick", &req.brick); - if (ret) - req.brick = ""; - - ret = cli_cmd_submit (&req, frame, cli_rpc_prog, - GLUSTER_CLI_LOG_LOCATE, NULL, - this, gf_cli3_1_log_locate_cbk, - (xdrproc_t) xdr_gf1_cli_log_locate_req); - -out: - gf_log ("cli", GF_LOG_DEBUG, "Returning %d", ret); - - return ret; -} int32_t gf_cli3_1_log_rotate (call_frame_t *frame, xlator_t *this, @@ -4439,8 +4241,6 @@ struct rpc_clnt_procedure gluster_cli_actors[GLUSTER_CLI_MAXVALUE] = { [GLUSTER_CLI_ADD_BRICK] = {"ADD_BRICK", gf_cli3_1_add_brick}, [GLUSTER_CLI_REMOVE_BRICK] = {"REMOVE_BRICK", gf_cli3_1_remove_brick}, [GLUSTER_CLI_REPLACE_BRICK] = {"REPLACE_BRICK", gf_cli3_1_replace_brick}, - [GLUSTER_CLI_LOG_FILENAME] = {"LOG FILENAME", gf_cli3_1_log_filename}, - [GLUSTER_CLI_LOG_LOCATE] = {"LOG LOCATE", gf_cli3_1_log_locate}, [GLUSTER_CLI_LOG_ROTATE] = {"LOG ROTATE", gf_cli3_1_log_rotate}, [GLUSTER_CLI_GETSPEC] = {"GETSPEC", gf_cli3_1_getspec}, [GLUSTER_CLI_PMAP_PORTBYBRICK] = {"PMAP PORTBYBRICK", gf_cli3_1_pmap_b2p}, @@ -4451,7 +4251,6 @@ 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}, [GLUSTER_CLI_STATUS_VOLUME] = {"STATUS_VOLUME", gf_cli3_1_status_volume}, [GLUSTER_CLI_MOUNT] = {"MOUNT", gf_cli3_1_mount}, @@ -4464,6 +4263,6 @@ struct rpc_clnt_program cli_prog = { .progname = "Gluster CLI", .prognum = GLUSTER_CLI_PROGRAM, .progver = GLUSTER_CLI_VERSION, - .numproc = GLUSTER_CLI_PROCCNT, + .numproc = GLUSTER_CLI_MAXVALUE, .proctable = gluster_cli_actors, }; |