e3c68b
From 90e52f3b44da0ed05e35ebd474e284d45794b0d6 Mon Sep 17 00:00:00 2001
e3c68b
From: Sanju Rakonde <srakonde@redhat.com>
e3c68b
Date: Thu, 10 Oct 2019 20:40:49 +0530
e3c68b
Subject: [PATCH 305/307] glusterd: rebalance start should fail when quorum is
e3c68b
 not met
e3c68b
e3c68b
rebalance start should not succeed if quorum is not met.
e3c68b
this patch adds a condition to check whether quorum is met
e3c68b
in pre-validation stage.
e3c68b
e3c68b
> fixes: bz#1760467
e3c68b
> Change-Id: Ic7d0d08f69e4bc6d5e7abae713ec1881531c8ad4
e3c68b
> Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
e3c68b
e3c68b
upstream patch: https://review.gluster.org/#/c/glusterfs/+/23536/
e3c68b
BUG: 1760261
e3c68b
Change-Id: Ic7d0d08f69e4bc6d5e7abae713ec1881531c8ad4
e3c68b
Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
e3c68b
Reviewed-on: https://code.engineering.redhat.com/gerrit/183146
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   | 2 ++
e3c68b
 xlators/mgmt/glusterd/src/glusterd-mgmt.c | 3 ++-
e3c68b
 2 files changed, 4 insertions(+), 1 deletion(-)
e3c68b
e3c68b
diff --git a/tests/bugs/glusterd/quorum-validation.t b/tests/bugs/glusterd/quorum-validation.t
e3c68b
index ff46729..3cc3351 100644
e3c68b
--- a/tests/bugs/glusterd/quorum-validation.t
e3c68b
+++ b/tests/bugs/glusterd/quorum-validation.t
e3c68b
@@ -34,6 +34,8 @@ 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
+#quorum is not met, rebalance/profile start should fail
e3c68b
+TEST ! $CLI_1 volume rebalance $V0 start
e3c68b
 TEST ! $CLI_1 volume profile $V0 start
e3c68b
 
e3c68b
 #bug-1690753 - Volume stop when quorum not met is successful
e3c68b
diff --git a/xlators/mgmt/glusterd/src/glusterd-mgmt.c b/xlators/mgmt/glusterd/src/glusterd-mgmt.c
e3c68b
index ec78913..a4915f3 100644
e3c68b
--- a/xlators/mgmt/glusterd/src/glusterd-mgmt.c
e3c68b
+++ b/xlators/mgmt/glusterd/src/glusterd-mgmt.c
e3c68b
@@ -1059,7 +1059,8 @@ 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 || op == GD_OP_STOP_VOLUME) {
e3c68b
+    if (op == GD_OP_PROFILE_VOLUME || op == GD_OP_STOP_VOLUME ||
e3c68b
+        op == GD_OP_REBALANCE) {
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