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