From 609a89ceace25a0a81d0a9cafde3a4d1afd1b916 Mon Sep 17 00:00:00 2001 From: Kaushik BV Date: Sun, 3 Oct 2010 02:41:29 +0000 Subject: mgmt/Glusterd: new command volume reset , volume set enhancements - Write the reconfigured options in 'info' file to make it persistant - Implementation of volume set history - Implementation of volume reset Signed-off-by: Kaushik BV Signed-off-by: Vijay Bellur BUG: 1159 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1159 --- cli/src/cli-cmd-volume.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 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 8d846d8732c..3c433c523e0 100644 --- a/cli/src/cli-cmd-volume.c +++ b/cli/src/cli-cmd-volume.c @@ -71,6 +71,12 @@ cli_cmd_volume_info_usage () cli_out ("Usage: volume info [all|]"); } +void +cli_cmd_volume_reset_usage () +{ + cli_out ("Usage: volume reset "); +} + void cli_cmd_volume_set_usage () { @@ -481,6 +487,41 @@ out: return 0; } +int +cli_cmd_volume_reset_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; + + proc = &cli_rpc_prog->proctable[GF1_CLI_RESET_VOLUME]; + + frame = create_frame (THIS, THIS->ctx->pool); + if (!frame) + goto out; + + ret = cli_cmd_volume_reset_parse (words, wordcount, &options); + + if (ret) { + cli_cmd_volume_reset_usage (); + goto out; + } + + if (proc->fn) { + ret = proc->fn (frame, THIS, options); + } + +out: + if (options) + dict_unref (options); + + return ret; + +} + int cli_cmd_volume_set_cbk (struct cli_state *state, struct cli_cmd_word *word, @@ -886,6 +927,10 @@ struct cli_cmd volume_cmds[] = { { "volume sync [all|]", cli_cmd_sync_volume_cbk, "sync the volume information from a peer"}, + + { "volume reset ", + cli_cmd_volume_reset_cbk, + "reset all the reconfigured options"}, { NULL, NULL, NULL } }; -- cgit