summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorkarthik-us <ksubrahm@redhat.com>2017-03-14 13:17:11 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2017-04-25 15:21:59 +0000
commitdb0e5582b118d5bb0c8bb491f46fa2ae0dcfa97e (patch)
tree6b77f16a6b704dd574c64c42ea611abc90c66aa9 /cli
parentfb66df4c4496f19a3800e8efa39c52f77320a2fb (diff)
cli: Adding warning message while creating a replica 2 volume
Warn the CLI about ending up in split-brain situation with a replica 2 volume. Display arbiter and replica 3 are recommended option to avoid this and point to the document on split-brain and ways to deal with it. Change-Id: I7f31f3c74818d440a684b3130bc5ccdc72258f01 BUG: 1431963 Signed-off-by: karthik-us <ksubrahm@redhat.com> Reviewed-on: https://review.gluster.org/16899 Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Tested-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'cli')
-rw-r--r--cli/src/cli-cmd-parser.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index c43b52b63a2..c3058b673f8 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -456,6 +456,8 @@ cli_cmd_volume_create_parse (struct cli_state *state, const char **words,
int32_t disperse_data_count = -1;
gf_boolean_t is_force = _gf_false;
int wc = wordcount;
+ gf_answer_t answer = GF_ANSWER_NO;
+ const char *question = NULL;
GF_ASSERT (words);
GF_ASSERT (options);
@@ -526,6 +528,22 @@ cli_cmd_volume_create_parse (struct cli_state *state, const char **words,
ret = -1;
goto out;
}
+ if (replica_count == 2) {
+ question = "Replica 2 volumes are prone to "
+ "split-brain. Use Arbiter or Replica"
+ " 3 to avoid this. See: "
+ " https://gluster.readthedocs.io/en/latest/Administrator%20Guide/Split%20brain%20and%20ways%20to%20deal%20with%20it/."
+ "\nDo you still want to continue?\n";
+ answer = cli_cmd_get_confirmation (state,
+ question);
+ if (GF_ANSWER_NO == answer) {
+ gf_log ("cli", GF_LOG_ERROR,
+ "Volume create cancelled, "
+ "exiting");
+ ret = -1;
+ goto out;
+ }
+ }
ret = dict_set_int32 (dict, "replica-count", replica_count);
if (ret)
goto out;