|
|
887953 |
From f3982cf5bf3250ee29da3ea4477591c298780043 Mon Sep 17 00:00:00 2001
|
|
|
887953 |
From: Sunil Kumar Acharya <sheggodu@redhat.com>
|
|
|
887953 |
Date: Mon, 17 Dec 2018 16:37:21 +0530
|
|
|
887953 |
Subject: [PATCH 485/493] cluster/ec : Prevent volume create without redundant
|
|
|
887953 |
brick
|
|
|
887953 |
|
|
|
887953 |
Problem:
|
|
|
887953 |
EC volumes can be created without any redundant brick.
|
|
|
887953 |
|
|
|
887953 |
Solution:
|
|
|
887953 |
Updated the conditional check to avoid volume create
|
|
|
887953 |
without redundant brick.
|
|
|
887953 |
|
|
|
887953 |
>fixes: bz#1642448
|
|
|
887953 |
>Change-Id: I0cb334b1b9378d67fcb8abf793dbe312c3179c0b
|
|
|
887953 |
>Signed-off-by: Sunil Kumar Acharya <sheggodu@redhat.com>
|
|
|
887953 |
Upstream Patch: https://review.gluster.org/#/c/glusterfs/+/21478/
|
|
|
887953 |
|
|
|
887953 |
BUG: 1597252
|
|
|
887953 |
Change-Id: I0cb334b1b9378d67fcb8abf793dbe312c3179c0b
|
|
|
887953 |
Signed-off-by: Sunil Kumar Acharya <sheggodu@redhat.com>
|
|
|
887953 |
Reviewed-on: https://code.engineering.redhat.com/gerrit/158910
|
|
|
887953 |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
887953 |
---
|
|
|
887953 |
cli/src/cli-cmd-parser.c | 6 +++---
|
|
|
887953 |
tests/basic/glusterd/disperse-create.t | 1 +
|
|
|
887953 |
2 files changed, 4 insertions(+), 3 deletions(-)
|
|
|
887953 |
|
|
|
887953 |
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
|
|
|
887953 |
index 3745fb4..e790d79 100644
|
|
|
887953 |
--- a/cli/src/cli-cmd-parser.c
|
|
|
887953 |
+++ b/cli/src/cli-cmd-parser.c
|
|
|
887953 |
@@ -275,9 +275,9 @@ cli_cmd_create_disperse_check (struct cli_state *state, int *disperse,
|
|
|
887953 |
tmp = *disperse - *redundancy;
|
|
|
887953 |
}
|
|
|
887953 |
|
|
|
887953 |
- if (*redundancy > (*disperse - 1) / 2) {
|
|
|
887953 |
- cli_err ("redundancy must be less than %d for a "
|
|
|
887953 |
- "disperse %d volume",
|
|
|
887953 |
+ if ((*redundancy < 1) || (*redundancy > (*disperse - 1) / 2)) {
|
|
|
887953 |
+ cli_err ("redundancy must be greater than or equal to 1 and"
|
|
|
887953 |
+ " less than %d for a disperse %d volume",
|
|
|
887953 |
(*disperse + 1) / 2, *disperse);
|
|
|
887953 |
|
|
|
887953 |
return -1;
|
|
|
887953 |
diff --git a/tests/basic/glusterd/disperse-create.t b/tests/basic/glusterd/disperse-create.t
|
|
|
887953 |
index e5ce74c..5b3ed13 100644
|
|
|
887953 |
--- a/tests/basic/glusterd/disperse-create.t
|
|
|
887953 |
+++ b/tests/basic/glusterd/disperse-create.t
|
|
|
887953 |
@@ -48,6 +48,7 @@ TEST ! $CLI volume create $V0 redundancy 1 redundancy 1 $H0:$B0/b20 $H0:$B0/b21
|
|
|
887953 |
#Minimum counts test
|
|
|
887953 |
TEST ! $CLI volume create $V0 disperse 2 $H0:$B0/b20 $H0:$B0/b22
|
|
|
887953 |
TEST ! $CLI volume create $V0 disperse-data 1 redundancy 0 $H0:$B0/b20 $H0:$B0/b22
|
|
|
887953 |
+TEST ! $CLI volume create $V0 disperse 4 disperse-data 4 $H0:$B0/b20 $H0:$B0/b21 $H0:$B0/b23 $H0:$B0/b24
|
|
|
887953 |
TEST ! $CLI volume create $V0 redundancy 0 $H0:$B0/b20 $H0:$B0/b22
|
|
|
887953 |
|
|
|
887953 |
#Wrong count n != k+m
|
|
|
887953 |
--
|
|
|
887953 |
1.8.3.1
|
|
|
887953 |
|