summaryrefslogtreecommitdiffstats
path: root/cli/src/cli-cmd-parser.c
diff options
context:
space:
mode:
authorRavishankar N <ravishankar@redhat.com>2021-03-23 13:16:57 +0530
committerGitHub <noreply@github.com>2021-03-23 13:16:57 +0530
commit81cb602908d47e8a4ed07e1e21746e118690aceb (patch)
tree3459312ade4eb791c90bbd93d06e0ed5e9f2a39c /cli/src/cli-cmd-parser.c
parent9d3bc96ed5842b43689a1f989255fac4f019c88f (diff)
downloadglusterfs-81cb602908d47e8a4ed07e1e21746e118690aceb.tar.gz
glusterfs-81cb602908d47e8a4ed07e1e21746e118690aceb.tar.xz
glusterfs-81cb602908d47e8a4ed07e1e21746e118690aceb.zip
cli: syntax check for arbiter volume creation (#2207) (#2222)
commit 8e7bfd6a58b444b26cb50fb98870e77302f3b9eb changed the syntax for arbiter volume creation to 'replica 2 arbiter 1', while still allowing the old syntax of 'replica 3 arbiter 1'. But while doing so, it also removed a conditional check, thereby allowing replica count > 3. This patch fixes it. Updates: #2192 Change-Id: Ie109325adb6d78e287e658fd5f59c26ad002e2d3 Signed-off-by: Ravishankar N <ravishankar@redhat.com>
Diffstat (limited to 'cli/src/cli-cmd-parser.c')
-rw-r--r--cli/src/cli-cmd-parser.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index 34620b4a31..777a05d9dd 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -657,7 +657,8 @@ cli_cmd_volume_create_parse(struct cli_state *state, const char **words,
if (words[index]) {
if (!strcmp(words[index], "arbiter")) {
ret = gf_string2int(words[index + 1], &arbiter_count);
- if ((ret == -1) || (arbiter_count != 1)) {
+ if ((ret == -1) || (arbiter_count != 1) ||
+ ((replica_count < 2) || (replica_count > 3))) {
cli_err(
"For arbiter "
"configuration, "