14f8ab
From d08083d057d6cc7136128cad6ecefba43b886c4c Mon Sep 17 00:00:00 2001
14f8ab
From: Vishal Pandey <vpandey@redhat.com>
14f8ab
Date: Thu, 9 May 2019 14:37:22 +0530
14f8ab
Subject: [PATCH 138/141] glusterd: Add gluster volume stop operation to
14f8ab
 glusterd_validate_quorum()
14f8ab
14f8ab
ISSUE: gluster volume stop succeeds even if quorum is not met.
14f8ab
14f8ab
Fix: Add GD_OP_STOP_VOLUME to gluster_validate_quorum in
14f8ab
glusterd_mgmt_v3_pre_validate ().
14f8ab
14f8ab
Since the volume stop command has been ported from synctask to mgmt_v3,
14f8ab
the quorum check was missed out.
14f8ab
14f8ab
>upstream patch : https://review.gluster.org/#/c/glusterfs/+/22692/
14f8ab
14f8ab
>Change-Id: I7a634ad89ec2e286ea262d7952061efad5360042
14f8ab
>fixes: bz#1690753
14f8ab
>Signed-off-by: Vishal Pandey <vpandey@redhat.com>
14f8ab
14f8ab
BUG: 1706893
14f8ab
Change-Id: I7a634ad89ec2e286ea262d7952061efad5360042
14f8ab
Signed-off-by: Vishal Pandey <vpandey@redhat.com>
14f8ab
Reviewed-on: https://code.engineering.redhat.com/gerrit/169949
14f8ab
Tested-by: RHGS Build Bot <nigelb@redhat.com>
14f8ab
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
14f8ab
---
14f8ab
 tests/bugs/glusterd/quorum-validation.t   | 4 +++-
14f8ab
 xlators/mgmt/glusterd/src/glusterd-mgmt.c | 2 +-
14f8ab
 2 files changed, 4 insertions(+), 2 deletions(-)
14f8ab
14f8ab
diff --git a/tests/bugs/glusterd/quorum-validation.t b/tests/bugs/glusterd/quorum-validation.t
14f8ab
index 05aef4e..ff46729 100644
14f8ab
--- a/tests/bugs/glusterd/quorum-validation.t
14f8ab
+++ b/tests/bugs/glusterd/quorum-validation.t
14f8ab
@@ -34,9 +34,11 @@ TEST ! $CLI_1 volume add-brick $V0 $H1:$B1/${V0}2
14f8ab
 TEST ! $CLI_1 volume remove-brick $V0 $H1:$B1/${V0}0 start
14f8ab
 TEST ! $CLI_1 volume set $V0 barrier enable
14f8ab
 
14f8ab
-# Now execute a command which goes through op state machine and it should fail
14f8ab
 TEST ! $CLI_1 volume profile $V0 start
14f8ab
 
14f8ab
+#bug-1690753 - Volume stop when quorum not met is successful
14f8ab
+TEST ! $CLI_1 volume stop $V0
14f8ab
+
14f8ab
 #Bring back the 2nd glusterd
14f8ab
 TEST $glusterd_2
14f8ab
 
14f8ab
diff --git a/xlators/mgmt/glusterd/src/glusterd-mgmt.c b/xlators/mgmt/glusterd/src/glusterd-mgmt.c
14f8ab
index 61ad66e..ec78913 100644
14f8ab
--- a/xlators/mgmt/glusterd/src/glusterd-mgmt.c
14f8ab
+++ b/xlators/mgmt/glusterd/src/glusterd-mgmt.c
14f8ab
@@ -1059,7 +1059,7 @@ glusterd_mgmt_v3_pre_validate(glusterd_op_t op, dict_t *req_dict,
14f8ab
         goto out;
14f8ab
     }
14f8ab
 
14f8ab
-    if (op == GD_OP_PROFILE_VOLUME) {
14f8ab
+    if (op == GD_OP_PROFILE_VOLUME || op == GD_OP_STOP_VOLUME) {
14f8ab
         ret = glusterd_validate_quorum(this, op, req_dict, op_errstr);
14f8ab
         if (ret) {
14f8ab
             gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_SERVER_QUORUM_NOT_MET,
14f8ab
-- 
14f8ab
1.8.3.1
14f8ab