summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVishal Pandey <vpandey@redhat.com>2019-05-09 14:37:22 +0530
committerAtin Mukherjee <amukherj@redhat.com>2019-05-11 04:14:47 +0000
commitb4db967224db3b16bc1d749fc2cb6f795363362d (patch)
treef804177f43bf5aebf924810091409e45aacc6cd5
parent5b7ab2e1699f35a0a14211a4e85805d95bcadb62 (diff)
glusterd: Add gluster volume stop operation to glusterd_validate_quorum()
ISSUE: gluster volume stop succeeds even if quorum is not met. Fix: Add GD_OP_STOP_VOLUME to gluster_validate_quorum in glusterd_mgmt_v3_pre_validate (). Since the volume stop command has been ported from synctask to mgmt_v3, the quorum check was missed out. Change-Id: I7a634ad89ec2e286ea262d7952061efad5360042 fixes: bz#1690753 Signed-off-by: Vishal Pandey <vpandey@redhat.com>
-rw-r--r--tests/bugs/glusterd/quorum-validation.t4
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-mgmt.c2
2 files changed, 4 insertions, 2 deletions
diff --git a/tests/bugs/glusterd/quorum-validation.t b/tests/bugs/glusterd/quorum-validation.t
index 05aef4e..ff46729 100644
--- a/tests/bugs/glusterd/quorum-validation.t
+++ b/tests/bugs/glusterd/quorum-validation.t
@@ -34,9 +34,11 @@ TEST ! $CLI_1 volume add-brick $V0 $H1:$B1/${V0}2
TEST ! $CLI_1 volume remove-brick $V0 $H1:$B1/${V0}0 start
TEST ! $CLI_1 volume set $V0 barrier enable
-# Now execute a command which goes through op state machine and it should fail
TEST ! $CLI_1 volume profile $V0 start
+#bug-1690753 - Volume stop when quorum not met is successful
+TEST ! $CLI_1 volume stop $V0
+
#Bring back the 2nd glusterd
TEST $glusterd_2
diff --git a/xlators/mgmt/glusterd/src/glusterd-mgmt.c b/xlators/mgmt/glusterd/src/glusterd-mgmt.c
index f5f44f6..b66d44f 100644
--- a/xlators/mgmt/glusterd/src/glusterd-mgmt.c
+++ b/xlators/mgmt/glusterd/src/glusterd-mgmt.c
@@ -1062,7 +1062,7 @@ glusterd_mgmt_v3_pre_validate(glusterd_op_t op, dict_t *req_dict,
goto out;
}
- if (op == GD_OP_PROFILE_VOLUME) {
+ if (op == GD_OP_PROFILE_VOLUME || op == GD_OP_STOP_VOLUME) {
ret = glusterd_validate_quorum(this, op, req_dict, op_errstr);
if (ret) {
gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_SERVER_QUORUM_NOT_MET,