From 5dedef81b6ef91d462ce49ded4e148dfc17deee2 Mon Sep 17 00:00:00 2001 From: Atin Mukherjee Date: Wed, 19 Mar 2014 11:30:22 +0530 Subject: cli: remove-brick no longer defaults to commit-force Problem : When gluster volume remove-brick is executed with out any option, it defaults to force commit which results in data loss. Fix : remove-brick can not be executed with out explicit option, user needs to provide the option in the command line else the command will throw back an usage error. Earlier usage : volume remove-brick [replica ] ... [start|stop|status|commit|force] Current usage : volume remove-brick [replica ] ... Change-Id: I2a49131f782a6c0dcd03b4dc8ebe5907999b0b49 BUG: 1077682 Signed-off-by: Atin Mukherjee Reviewed-on: http://review.gluster.org/7292 Tested-by: Gluster Build System Reviewed-by: Shyamsundar Ranganathan Reviewed-by: Vijay Bellur --- cli/src/cli-cmd-parser.c | 10 ++++------ cli/src/cli-cmd-volume.c | 3 ++- 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'cli') diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c index 1513e0c5e..9777e655f 100644 --- a/cli/src/cli-cmd-parser.c +++ b/cli/src/cli-cmd-parser.c @@ -1118,7 +1118,7 @@ cli_cmd_volume_remove_brick_parse (const char **words, int wordcount, GF_ASSERT (words); GF_ASSERT (options); - if (wordcount < 4) + if (wordcount < 5) goto out; dict = dict_new (); @@ -1136,7 +1136,7 @@ cli_cmd_volume_remove_brick_parse (const char **words, int wordcount, brick_index = 3; w = str_getunamb (words[3], type_opword); if (w && !strcmp ("replica", w)) { - if (wordcount < 5) { + if (wordcount < 6) { ret = -1; goto out; } @@ -1158,10 +1158,8 @@ cli_cmd_volume_remove_brick_parse (const char **words, int wordcount, w = str_getunamb (words[wordcount - 1], opwords); if (!w) { - /* Should be default 'force' */ - command = GF_OP_CMD_COMMIT_FORCE; - if (question) - *question = 1; + ret = -1; + goto out; } else { /* handled this option */ wordcount--; diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c index e334ddc84..3b927d2bd 100644 --- a/cli/src/cli-cmd-volume.c +++ b/cli/src/cli-cmd-volume.c @@ -2299,7 +2299,8 @@ struct cli_cmd volume_cmds[] = { cli_cmd_volume_add_brick_cbk, "add brick to volume "}, - { "volume remove-brick [replica ] ... [start|stop|status|commit|force]", + { "volume remove-brick [replica ] ..." + " ", cli_cmd_volume_remove_brick_cbk, "remove brick from volume "}, -- cgit