summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiels de Vos <ndevos@redhat.com>2017-09-26 14:51:27 +0200
committerjiffin tony Thottan <jthottan@redhat.com>2017-10-06 06:31:49 +0000
commit0aa823e3f52276f67591b00f364e6b8e139be036 (patch)
treebf6c3e8fc04ec54897fff2e543479f65b5bfbf91
parent0a1792901df2b9804e5ac20102a2c2e4a28bdfc0 (diff)
cli: Bypass the confirmation question creating replica 2 volume with force
When a replica 2 volume is created with the force option, remove the warning message with the confirmation question, whether they want to continue or not and Succeed the volume creation. Cherry picked from commit f449e53df7c07301b495b4ff688d165026dfd2d0: > Change-Id: I4f3306659fa4cbf53dd8d45269a32d19ce86ac88 > BUG: 1493893 > Signed-off-by: karthik-us <ksubrahm@redhat.com> While backporting the URL for the documentation has been adjusted as well. This comes from commit eb2f1ab4cd which also corrects other URLs (those are not included in this backport). Change-Id: I4f3306659fa4cbf53dd8d45269a32d19ce86ac88 BUG: 1495858 Signed-off-by: Niels de Vos <ndevos@redhat.com>
-rw-r--r--cli/src/cli-cmd-parser.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index 45e93df8b9a..a613e5dee60 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -529,19 +529,23 @@ cli_cmd_volume_create_parse (struct cli_state *state, const char **words,
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;
+ if (strcmp (words[wordcount - 1], "force")) {
+ question = "Replica 2 volumes are prone"
+ " to split-brain. Use "
+ "Arbiter or Replica 3 to "
+ "avoid this. See: "
+ "http://docs.gluster.org/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);