glusterfs/0400-cli-throw-a-warning-if-replica-count-greater-than-3.patch
Rinku Kothiya 14e44be7b0 autobuild v6.0-38
Resolves: bz#1234220 bz#1286171 bz#1487177 bz#1524457 bz#1640573
Resolves: bz#1663557 bz#1667954 bz#1683602 bz#1686897 bz#1721355
Resolves: bz#1748865 bz#1750211 bz#1754391 bz#1759875 bz#1761531
Resolves: bz#1761932 bz#1763124 bz#1763129 bz#1764091 bz#1775637
Resolves: bz#1776901 bz#1781550 bz#1781649 bz#1781710 bz#1783232
Resolves: bz#1784211 bz#1784415 bz#1786516 bz#1786681 bz#1787294
Resolves: bz#1787310 bz#1787331 bz#1787994 bz#1790336 bz#1792873
Resolves: bz#1794663 bz#1796814 bz#1804164 bz#1810924 bz#1815434
Resolves: bz#1836099 bz#1837467 bz#1837926 bz#1838479 bz#1839137
Resolves: bz#1844359
Signed-off-by: Rinku Kothiya <rkothiya@redhat.com>
2020-06-10 00:48:36 -04:00

99 lines
3.8 KiB
Diff

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