|
|
d84cf8 |
From 12ed9226fa24d073ab2b89692194b454a194c379 Mon Sep 17 00:00:00 2001
|
|
|
d84cf8 |
From: Sanju Rakonde <srakonde@redhat.com>
|
|
|
d84cf8 |
Date: Thu, 4 Jun 2020 15:14:29 +0530
|
|
|
d84cf8 |
Subject: [PATCH 400/449] cli: throw a warning if replica count greater than 3
|
|
|
d84cf8 |
|
|
|
d84cf8 |
As volumes with replica count greater than 3 are not
|
|
|
d84cf8 |
supported, a warning message is be thrown to user
|
|
|
d84cf8 |
while creating the volume with replica count greater
|
|
|
d84cf8 |
than 3 or while converting a volume to replica > 3
|
|
|
d84cf8 |
volume by add-brick/remove-brick operations.
|
|
|
d84cf8 |
|
|
|
d84cf8 |
Label: DOWNSTREAM ONLY
|
|
|
d84cf8 |
|
|
|
d84cf8 |
BUG: 1763129
|
|
|
d84cf8 |
Change-Id: I5a32a5a2d99b5175fb692dfcab27396089f24b72
|
|
|
d84cf8 |
Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
|
|
|
d84cf8 |
Reviewed-on: https://code.engineering.redhat.com/gerrit/202338
|
|
|
d84cf8 |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
d84cf8 |
Reviewed-by: Mohit Agrawal <moagrawa@redhat.com>
|
|
|
d84cf8 |
Reviewed-by: Ravishankar Narayanankutty <ravishankar@redhat.com>
|
|
|
d84cf8 |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
d84cf8 |
---
|
|
|
d84cf8 |
cli/src/cli-cmd-parser.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
|
|
|
d84cf8 |
1 file changed, 45 insertions(+)
|
|
|
d84cf8 |
|
|
|
d84cf8 |
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
|
|
|
d84cf8 |
index ac0a263..5e7ce53 100644
|
|
|
d84cf8 |
--- a/cli/src/cli-cmd-parser.c
|
|
|
d84cf8 |
+++ b/cli/src/cli-cmd-parser.c
|
|
|
d84cf8 |
@@ -619,6 +619,23 @@ cli_cmd_volume_create_parse(struct cli_state *state, const char **words,
|
|
|
d84cf8 |
}
|
|
|
d84cf8 |
}
|
|
|
d84cf8 |
}
|
|
|
d84cf8 |
+
|
|
|
d84cf8 |
+ if (replica_count > 3) {
|
|
|
d84cf8 |
+ if (strcmp(words[wordcount - 1], "force")) {
|
|
|
d84cf8 |
+ question =
|
|
|
d84cf8 |
+ "Volumes with replica count greater than 3 are"
|
|
|
d84cf8 |
+ "not supported. \nDo you still want to continue?\n";
|
|
|
d84cf8 |
+ answer = cli_cmd_get_confirmation(state, question);
|
|
|
d84cf8 |
+ if (GF_ANSWER_NO == answer) {
|
|
|
d84cf8 |
+ gf_log("cli", GF_LOG_ERROR,
|
|
|
d84cf8 |
+ "Volume create "
|
|
|
d84cf8 |
+ "cancelled, exiting");
|
|
|
d84cf8 |
+ ret = -1;
|
|
|
d84cf8 |
+ goto out;
|
|
|
d84cf8 |
+ }
|
|
|
d84cf8 |
+ }
|
|
|
d84cf8 |
+ }
|
|
|
d84cf8 |
+
|
|
|
d84cf8 |
ret = dict_set_int32(dict, "replica-count", replica_count);
|
|
|
d84cf8 |
if (ret)
|
|
|
d84cf8 |
goto out;
|
|
|
d84cf8 |
@@ -1815,6 +1832,20 @@ cli_cmd_volume_add_brick_parse(struct cli_state *state, const char **words,
|
|
|
d84cf8 |
goto out;
|
|
|
d84cf8 |
}
|
|
|
d84cf8 |
}
|
|
|
d84cf8 |
+ } else if (count > 3) {
|
|
|
d84cf8 |
+ if (strcmp(words[wordcount - 1], "force")) {
|
|
|
d84cf8 |
+ question =
|
|
|
d84cf8 |
+ "Volumes with replica count greater than 3 are"
|
|
|
d84cf8 |
+ "not supported. \nDo you still want to continue?\n";
|
|
|
d84cf8 |
+ answer = cli_cmd_get_confirmation(state, question);
|
|
|
d84cf8 |
+ if (GF_ANSWER_NO == answer) {
|
|
|
d84cf8 |
+ gf_log("cli", GF_LOG_ERROR,
|
|
|
d84cf8 |
+ "add-brick "
|
|
|
d84cf8 |
+ "cancelled, exiting");
|
|
|
d84cf8 |
+ ret = -1;
|
|
|
d84cf8 |
+ goto out;
|
|
|
d84cf8 |
+ }
|
|
|
d84cf8 |
+ }
|
|
|
d84cf8 |
}
|
|
|
d84cf8 |
} else if ((strcmp(w, "stripe")) == 0) {
|
|
|
d84cf8 |
cli_err("stripe option not supported");
|
|
|
d84cf8 |
@@ -2082,6 +2113,20 @@ cli_cmd_volume_remove_brick_parse(struct cli_state *state, const char **words,
|
|
|
d84cf8 |
goto out;
|
|
|
d84cf8 |
}
|
|
|
d84cf8 |
}
|
|
|
d84cf8 |
+ } else if (count > 3) {
|
|
|
d84cf8 |
+ if (strcmp(words[wordcount - 1], "force")) {
|
|
|
d84cf8 |
+ ques =
|
|
|
d84cf8 |
+ "Volumes with replica count greater than 3 are"
|
|
|
d84cf8 |
+ "not supported. \nDo you still want to continue?\n";
|
|
|
d84cf8 |
+ answer = cli_cmd_get_confirmation(state, ques);
|
|
|
d84cf8 |
+ if (GF_ANSWER_NO == answer) {
|
|
|
d84cf8 |
+ gf_log("cli", GF_LOG_ERROR,
|
|
|
d84cf8 |
+ "Remove-brick "
|
|
|
d84cf8 |
+ "cancelled, exiting");
|
|
|
d84cf8 |
+ ret = -1;
|
|
|
d84cf8 |
+ goto out;
|
|
|
d84cf8 |
+ }
|
|
|
d84cf8 |
+ }
|
|
|
d84cf8 |
}
|
|
|
d84cf8 |
|
|
|
d84cf8 |
ret = dict_set_int32(dict, "replica-count", count);
|
|
|
d84cf8 |
--
|
|
|
d84cf8 |
1.8.3.1
|
|
|
d84cf8 |
|