summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cli/src/cli-cmd-parser.c10
-rw-r--r--cli/src/cli-cmd-volume.c3
-rwxr-xr-xtests/basic/volume.t2
-rw-r--r--tests/bugs/bug-1077682.t34
-rw-r--r--tests/bugs/bug-867252.t2
-rw-r--r--tests/bugs/bug-878004.t4
-rw-r--r--tests/bugs/bug-961669.t2
7 files changed, 45 insertions, 12 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index 1513e0c5ef5..9777e655fe3 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -1118,7 +1118,7 @@ cli_cmd_volume_remove_brick_parse (const char **words, int wordcount,
GF_ASSERT (words);
GF_ASSERT (options);
- if (wordcount < 4)
+ if (wordcount < 5)
goto out;
dict = dict_new ();
@@ -1136,7 +1136,7 @@ cli_cmd_volume_remove_brick_parse (const char **words, int wordcount,
brick_index = 3;
w = str_getunamb (words[3], type_opword);
if (w && !strcmp ("replica", w)) {
- if (wordcount < 5) {
+ if (wordcount < 6) {
ret = -1;
goto out;
}
@@ -1158,10 +1158,8 @@ cli_cmd_volume_remove_brick_parse (const char **words, int wordcount,
w = str_getunamb (words[wordcount - 1], opwords);
if (!w) {
- /* Should be default 'force' */
- command = GF_OP_CMD_COMMIT_FORCE;
- if (question)
- *question = 1;
+ ret = -1;
+ goto out;
} else {
/* handled this option */
wordcount--;
diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c
index e334ddc8443..3b927d2bd3c 100644
--- a/cli/src/cli-cmd-volume.c
+++ b/cli/src/cli-cmd-volume.c
@@ -2299,7 +2299,8 @@ struct cli_cmd volume_cmds[] = {
cli_cmd_volume_add_brick_cbk,
"add brick to volume <VOLNAME>"},
- { "volume remove-brick <VOLNAME> [replica <COUNT>] <BRICK> ... [start|stop|status|commit|force]",
+ { "volume remove-brick <VOLNAME> [replica <COUNT>] <BRICK> ..."
+ " <start|stop|status|commit|force>",
cli_cmd_volume_remove_brick_cbk,
"remove brick from volume <VOLNAME>"},
diff --git a/tests/basic/volume.t b/tests/basic/volume.t
index 2f9096055e7..23b740af1ed 100755
--- a/tests/basic/volume.t
+++ b/tests/basic/volume.t
@@ -22,7 +22,7 @@ EXPECT 'Started' volinfo_field $V0 'Status';
TEST $CLI volume add-brick $V0 $H0:$B0/${V0}{9,10,11,12};
EXPECT '12' brick_count $V0
-TEST $CLI volume remove-brick $V0 $H0:$B0/${V0}{1,2,3,4};
+TEST $CLI volume remove-brick $V0 $H0:$B0/${V0}{1,2,3,4} force;
EXPECT '8' brick_count $V0
TEST $CLI volume stop $V0;
diff --git a/tests/bugs/bug-1077682.t b/tests/bugs/bug-1077682.t
new file mode 100644
index 00000000000..2923c5f66dd
--- /dev/null
+++ b/tests/bugs/bug-1077682.t
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+. $(dirname $0)/../include.rc
+. $(dirname $0)/../volume.rc
+
+function get-task-status()
+{
+ $CLI $COMMAND | grep -o $PATTERN
+ if [ ${PIPESTATUS[0]} -ne 0 ];
+ then
+ return 1
+ fi
+ return 0
+}
+
+cleanup;
+
+TEST glusterd
+TEST pidof glusterd
+
+TEST $CLI volume create $V0 $H0:$B0/${V0}{1,2,3,4}
+TEST $CLI volume start $V0
+TEST ! $CLI volume remove-brick $V0 $H0:$B0/${V0}1
+TEST $CLI volume remove-brick $V0 $H0:$B0/${V0}2 force
+TEST $CLI volume remove-brick $V0 $H0:$B0/${V0}3 start
+
+EXPECT_WITHIN 10 "completed" remove_brick_status_completed_field "$V0" \
+"$H0:$B0/${V0}3"
+
+TEST $CLI volume remove-brick $V0 $H0:$B0/${V0}3 commit
+TEST killall glusterd
+TEST glusterd
+
+cleanup
diff --git a/tests/bugs/bug-867252.t b/tests/bugs/bug-867252.t
index 8309ed9b9a0..17edcd9c5dc 100644
--- a/tests/bugs/bug-867252.t
+++ b/tests/bugs/bug-867252.t
@@ -35,7 +35,7 @@ EXPECT '1' brick_count $V0
TEST $CLI volume add-brick $V0 $H0:$B0/${V0}2;
EXPECT '2' brick_count $V0
-TEST $CLI volume remove-brick $V0 $H0:$B0/${V0}2;
+TEST $CLI volume remove-brick $V0 $H0:$B0/${V0}2 force;
EXPECT '1' brick_count $V0
cleanup;
diff --git a/tests/bugs/bug-878004.t b/tests/bugs/bug-878004.t
index 5bee4c62fc3..407fd6eccec 100644
--- a/tests/bugs/bug-878004.t
+++ b/tests/bugs/bug-878004.t
@@ -19,10 +19,10 @@ function brick_count()
TEST $CLI volume start $V0
-TEST $CLI volume remove-brick $V0 $H0:$B0/${V0}2;
+TEST $CLI volume remove-brick $V0 $H0:$B0/${V0}2 force;
EXPECT '2' brick_count $V0
-TEST $CLI volume remove-brick $V0 $H0:$B0/${V0}3;
+TEST $CLI volume remove-brick $V0 $H0:$B0/${V0}3 force;
EXPECT '1' brick_count $V0
cleanup;
diff --git a/tests/bugs/bug-961669.t b/tests/bugs/bug-961669.t
index 751a63df2be..77896481c3f 100644
--- a/tests/bugs/bug-961669.t
+++ b/tests/bugs/bug-961669.t
@@ -27,7 +27,7 @@ function remove_brick_start {
}
function remove_brick {
- $CLI volume remove-brick $V0 replica 2 $H0:$B0/${V0}{1,4,7} 2>&1|grep -oE 'success|failed'
+ $CLI volume remove-brick $V0 replica 2 $H0:$B0/${V0}{1,4,7} force 2>&1|grep -oE 'success|failed'
}
#remove-brick start variant