cluster/ec : Prevent volume create without redundant brick
Problem: EC volumes can be created without any redundant brick. Solution: Updated the conditional check to avoid volume create without redundant brick. fixes: bz#1642448 Change-Id: I0cb334b1b9378d67fcb8abf793dbe312c3179c0b Signed-off-by: Sunil Kumar Acharya <sheggodu@redhat.com>
This commit is contained in:
parent
87613d265a
commit
e15a5a5cc6
@ -310,10 +310,10 @@ cli_cmd_create_disperse_check(struct cli_state *state, int *disperse,
|
||||
tmp = *disperse - *redundancy;
|
||||
}
|
||||
|
||||
if (*redundancy > (*disperse - 1) / 2) {
|
||||
if ((*redundancy < 1) || (*redundancy > (*disperse - 1) / 2)) {
|
||||
cli_err(
|
||||
"redundancy must be less than %d for a "
|
||||
"disperse %d volume",
|
||||
"redundancy must be greater than or equal to 1 and "
|
||||
"less than %d for a disperse %d volume",
|
||||
(*disperse + 1) / 2, *disperse);
|
||||
|
||||
return -1;
|
||||
|
@ -48,6 +48,7 @@ TEST ! $CLI volume create $V0 redundancy 1 redundancy 1 $H0:$B0/b20 $H0:$B0/b21
|
||||
#Minimum counts test
|
||||
TEST ! $CLI volume create $V0 disperse 2 $H0:$B0/b20 $H0:$B0/b22
|
||||
TEST ! $CLI volume create $V0 disperse-data 1 redundancy 0 $H0:$B0/b20 $H0:$B0/b22
|
||||
TEST ! $CLI volume create $V0 disperse 4 disperse-data 4 $H0:$B0/b20 $H0:$B0/b21 $H0:$B0/b23 $H0:$B0/b24
|
||||
TEST ! $CLI volume create $V0 redundancy 0 $H0:$B0/b20 $H0:$B0/b22
|
||||
|
||||
#Wrong count n != k+m
|
||||
|
Loading…
x
Reference in New Issue
Block a user