From 4175d3e8e2ca1afc0e9f3404ca04fe29d522c81f Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Tue, 1 Mar 2011 03:37:12 +0000 Subject: gluster rebalance: give option to split the command the 'gluster volume rebalance start' is enhanced with two more options: * 'gluster volume rebalance fix-layout start' (for fixing layout only) * 'gluster volume rebalance migrate-data start' (for migrating data only) Also the old way of running rebalance in one shot will still work fine * 'gluster volume rebalance start' Signed-off-by: Amar Tumballi Signed-off-by: Anand V. Avati BUG: 2258 (enhance gluster volume rebalance) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2258 --- cli/src/cli-cmd-volume.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (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 9e93d4e97..a790b326e 100644 --- a/cli/src/cli-cmd-volume.c +++ b/cli/src/cli-cmd-volume.c @@ -476,7 +476,7 @@ cli_cmd_volume_defrag_cbk (struct cli_state *state, struct cli_cmd_word *word, if (!dict) goto out; - if (wordcount != 4) { + if (!((wordcount == 4) || (wordcount == 5))) { cli_usage_out (word->pattern); parse_error = 1; goto out; @@ -486,9 +486,19 @@ cli_cmd_volume_defrag_cbk (struct cli_state *state, struct cli_cmd_word *word, if (ret) goto out; - ret = dict_set_str (dict, "command", (char *)words[3]); - if (ret) - goto out; + if (wordcount == 4) { + ret = dict_set_str (dict, "command", (char *)words[3]); + if (ret) + goto out; + } + if (wordcount == 5) { + ret = dict_set_str (dict, "start-type", (char *)words[3]); + if (ret) + goto out; + ret = dict_set_str (dict, "command", (char *)words[4]); + if (ret) + goto out; + } proc = &cli_rpc_prog->proctable[GLUSTER_CLI_DEFRAG_VOLUME]; @@ -962,7 +972,7 @@ struct cli_cmd volume_cmds[] = { cli_cmd_volume_remove_brick_cbk, "remove brick from volume "}, - { "volume rebalance {start|stop|status}", + { "volume rebalance [fix-layout|migrate-data] {start|stop|status}", cli_cmd_volume_defrag_cbk, "rebalance operations"}, -- cgit