From 5b91bef50d834e597f8c62b83419f26d146e631f Mon Sep 17 00:00:00 2001 From: Krutika Dhananjay Date: Tue, 12 Feb 2013 17:26:35 +0530 Subject: glusterd: changes in 'volume create' behaviour Backport of http://review.gluster.org/4740 Note: This patch is needed by oVirt's Gluster Integration Project BUG: 948729 Change-Id: I7a9d7c36b7e15269f95637cd9061abac6f8a97de Signed-off-by: Krutika Dhananjay Reviewed-on: http://review.gluster.org/6355 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- cli/src/cli-cmd-volume.c | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 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 4dcb99ce2..216a2b6bf 100644 --- a/cli/src/cli-cmd-volume.c +++ b/cli/src/cli-cmd-volume.c @@ -392,6 +392,15 @@ cli_cmd_volume_create_cbk (struct cli_state *state, struct cli_cmd_word *word, } } + if (state->mode & GLUSTER_MODE_SCRIPT) { + ret = dict_set_int32 (options, "force", _gf_true); + if (ret) { + gf_log ("cli", GF_LOG_ERROR, "Failed to set force " + "option"); + goto out; + } + } + CLI_LOCAL_INIT (local, words, frame, options); if (proc->fn) { @@ -963,6 +972,15 @@ cli_cmd_volume_add_brick_cbk (struct cli_state *state, } } + if (state->mode & GLUSTER_MODE_SCRIPT) { + ret = dict_set_int32 (options, "force", _gf_true); + if (ret) { + gf_log ("cli", GF_LOG_ERROR, "Failed to set force " + "option"); + goto out; + } + } + proc = &cli_rpc_prog->proctable[GLUSTER_CLI_ADD_BRICK]; CLI_LOCAL_INIT (local, words, frame, options); @@ -1131,6 +1149,15 @@ cli_cmd_volume_replace_brick_cbk (struct cli_state *state, goto out; } + if (state->mode & GLUSTER_MODE_SCRIPT) { + ret = dict_set_int32 (options, "force", _gf_true); + if (ret) { + gf_log ("cli", GF_LOG_ERROR, "Failed to set force" + "option"); + goto out; + } + } + CLI_LOCAL_INIT (local, words, frame, options); if (proc->fn) { @@ -1795,7 +1822,11 @@ struct cli_cmd volume_cmds[] = { cli_cmd_volume_info_cbk, "list information of all volumes"}, - { "volume create [stripe ] [replica ] [device vg] [transport ] ...", + { "volume create [stripe ] [replica ] " +#ifdef HAVE_BD_XLATOR + "[device vg] " +#endif + "[transport ] ... [force]", cli_cmd_volume_create_cbk, "create a new volume of specified type with mentioned bricks"}, @@ -1815,7 +1846,7 @@ struct cli_cmd volume_cmds[] = { cli_cmd_volume_rename_cbk, "rename volume to "},*/ - { "volume add-brick [ ] ...", + { "volume add-brick [ ] ... [force]", cli_cmd_volume_add_brick_cbk, "add brick to volume "}, @@ -1827,7 +1858,7 @@ struct cli_cmd volume_cmds[] = { cli_cmd_volume_defrag_cbk, "rebalance operations"}, - { "volume replace-brick {start|pause|abort|status|commit [force]}", + { "volume replace-brick {start [force]|pause|abort|status|commit [force]}", cli_cmd_volume_replace_brick_cbk, "replace-brick operations"}, -- cgit