From 3d1fc9ebe2b0292108dd0737cf8f40d6fcb8cf51 Mon Sep 17 00:00:00 2001 From: shishir gowda Date: Wed, 16 Mar 2011 03:35:16 +0000 Subject: TOP: cli, rpc/xdr related changes Signed-off-by: shishir gowda Signed-off-by: Vijay Bellur BUG: 2516 (Implement gluster volume top command) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2516 --- cli/src/cli-cmd-volume.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'cli/src/cli-cmd-volume.c') diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c index f7f333001ee..3bd54a6fb3b 100644 --- a/cli/src/cli-cmd-volume.c +++ b/cli/src/cli-cmd-volume.c @@ -901,6 +901,49 @@ out: return ret; } +int +cli_cmd_volume_top_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; + + ret = cli_cmd_volume_top_parse (words, wordcount, &options); + + if (ret) { + parse_error = 1; + cli_usage_out (word->pattern); + goto out; + } + + proc = &cli_rpc_prog->proctable[GLUSTER_CLI_TOP_VOLUME]; + + frame = create_frame (THIS, THIS->ctx->pool); + if (!frame) + goto out; + + if (proc->fn) { + ret = proc->fn (frame, THIS, options); + } + +out: + if (options) + dict_unref (options); + + if (ret) { + cli_cmd_sent_status_get (&sent); + if ((sent == 0) && (parse_error == 0)) + cli_out ("Volume top failed"); + } + + return ret; + +} int cli_cmd_log_locate_cbk (struct cli_state *state, struct cli_cmd_word *word, @@ -1119,6 +1162,12 @@ struct cli_cmd volume_cmds[] = { cli_cmd_quota_cbk, "quota translator specific operations"}, + { "volume top {[open|read|write|opendir|readdir] " + "|[read-perf|write-perf bs count ]} " + " [brick ] [list-cnt ]", + cli_cmd_volume_top_cbk, + "volume profile operations"}, + { NULL, NULL, NULL } }; -- cgit