summaryrefslogtreecommitdiffstats
path: root/cli/src/cli-cmd-volume.c
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2011-06-16 07:39:43 +0000
committerAnand Avati <avati@gluster.com>2011-06-16 22:01:59 -0700
commite3a061d6fa5f436fe37493b7257860014ae75950 (patch)
tree3a6094756319b9ea5c0026470b5aefe96790f53a /cli/src/cli-cmd-volume.c
parent442f64a83bd2c5da085bc6dc50533df2d483be3b (diff)
gluster rebalance: bring in a 'force' option
* also correct the free space available logic to check the size without the file in migration (this considers the sparse files too) * 'force' option will bypass the free-space check logic, hence will cleanup all the linkfile * 'force' option is valid only with 'migrate-data' option Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 2258 (enhance gluster volume rebalance) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2258
Diffstat (limited to 'cli/src/cli-cmd-volume.c')
-rw-r--r--cli/src/cli-cmd-volume.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c
index 68ac79878db..7027180f0f5 100644
--- a/cli/src/cli-cmd-volume.c
+++ b/cli/src/cli-cmd-volume.c
@@ -481,7 +481,7 @@ cli_cmd_volume_defrag_cbk (struct cli_state *state, struct cli_cmd_word *word,
if (!dict)
goto out;
- if (!((wordcount == 4) || (wordcount == 5))) {
+ if (!((wordcount == 4) || (wordcount == 5) || (wordcount == 6))) {
cli_usage_out (word->pattern);
parse_error = 1;
goto out;
@@ -490,7 +490,7 @@ cli_cmd_volume_defrag_cbk (struct cli_state *state, struct cli_cmd_word *word,
if (wordcount == 4) {
index = 3;
} else {
- if (strcmp (words[3], "fix-layout") &&
+ if (strcmp (words[3], "fix-layout") &&
strcmp (words[3], "migrate-data")) {
cli_usage_out (word->pattern);
parse_error = 1;
@@ -499,7 +499,7 @@ cli_cmd_volume_defrag_cbk (struct cli_state *state, struct cli_cmd_word *word,
index = 4;
}
- if (strcmp (words[index], "start") && strcmp (words[index], "stop") &&
+ if (strcmp (words[index], "start") && strcmp (words[index], "stop") &&
strcmp (words[index], "status")) {
cli_usage_out (word->pattern);
parse_error = 1;
@@ -524,6 +524,23 @@ cli_cmd_volume_defrag_cbk (struct cli_state *state, struct cli_cmd_word *word,
goto out;
}
+ /* 'force' option is valid only for the 'migrate-data' key */
+ if (wordcount == 6) {
+ if (strcmp (words[3], "migrate-data") ||
+ strcmp (words[4], "start") ||
+ strcmp (words[5], "force")) {
+ cli_usage_out (word->pattern);
+ parse_error = 1;
+ goto out;
+ }
+ ret = dict_set_str (dict, "start-type", "migrate-data-force");
+ 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];
if (proc->fn) {
@@ -1227,7 +1244,7 @@ struct cli_cmd volume_cmds[] = {
cli_cmd_volume_remove_brick_cbk,
"remove brick from volume <VOLNAME>"},
- { "volume rebalance <VOLNAME> [fix-layout|migrate-data] {start|stop|status}",
+ { "volume rebalance <VOLNAME> [fix-layout|migrate-data] {start|stop|status} [force]",
cli_cmd_volume_defrag_cbk,
"rebalance operations"},