|
|
74096c |
From 80f1b3aedcde02ae25b341519857ba9a5b2fa722 Mon Sep 17 00:00:00 2001
|
|
|
74096c |
From: Sheetal Pamecha <spamecha@redhat.com>
|
|
|
74096c |
Date: Thu, 24 Sep 2020 19:43:29 +0530
|
|
|
74096c |
Subject: [PATCH 473/473] glusterd: Fix Add-brick with increasing replica count
|
|
|
74096c |
failure
|
|
|
74096c |
|
|
|
74096c |
Problem: add-brick operation fails with multiple bricks on same
|
|
|
74096c |
server error when replica count is increased.
|
|
|
74096c |
|
|
|
74096c |
This was happening because of extra runs in a loop to compare
|
|
|
74096c |
hostnames and if bricks supplied were less than "replica" count,
|
|
|
74096c |
the bricks will get compared to itself resulting in above error.
|
|
|
74096c |
|
|
|
74096c |
>Upstream-patch: https://review.gluster.org/#/c/glusterfs/+/25029
|
|
|
74096c |
>Fixes: #1508
|
|
|
74096c |
|
|
|
74096c |
BUG: 1881823
|
|
|
74096c |
Change-Id: I8668e964340b7bf59728bb838525d2db062197ed
|
|
|
74096c |
Signed-off-by: Sheetal Pamecha <spamecha@redhat.com>
|
|
|
74096c |
Reviewed-on: https://code.engineering.redhat.com/gerrit/213064
|
|
|
74096c |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
74096c |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
74096c |
---
|
|
|
74096c |
tests/bugs/glusterd/brick-order-check-add-brick.t | 21 +++++++++++++++++++++
|
|
|
74096c |
xlators/mgmt/glusterd/src/glusterd-utils.c | 4 ++++
|
|
|
74096c |
2 files changed, 25 insertions(+)
|
|
|
74096c |
|
|
|
74096c |
diff --git a/tests/bugs/glusterd/brick-order-check-add-brick.t b/tests/bugs/glusterd/brick-order-check-add-brick.t
|
|
|
74096c |
index 29f0ed1..0be31da 100644
|
|
|
74096c |
--- a/tests/bugs/glusterd/brick-order-check-add-brick.t
|
|
|
74096c |
+++ b/tests/bugs/glusterd/brick-order-check-add-brick.t
|
|
|
74096c |
@@ -37,4 +37,25 @@ EXPECT '3 x 3 = 9' volinfo_field $V0 'Number of Bricks'
|
|
|
74096c |
TEST $CLI_1 volume add-brick $V0 $H1:$L1/${V0}_3 $H1:$L1/${V0}_4 $H1:$L1/${V0}_5 force
|
|
|
74096c |
EXPECT '4 x 3 = 12' volinfo_field $V0 'Number of Bricks'
|
|
|
74096c |
|
|
|
74096c |
+TEST $CLI_1 volume stop $V0
|
|
|
74096c |
+TEST $CLI_1 volume delete $V0
|
|
|
74096c |
+
|
|
|
74096c |
+TEST $CLI_1 volume create $V0 replica 2 $H1:$L1/${V0}1 $H2:$L2/${V0}1
|
|
|
74096c |
+EXPECT '1 x 2 = 2' volinfo_field $V0 'Number of Bricks'
|
|
|
74096c |
+EXPECT 'Created' volinfo_field $V0 'Status'
|
|
|
74096c |
+
|
|
|
74096c |
+TEST $CLI_1 volume start $V0
|
|
|
74096c |
+EXPECT 'Started' volinfo_field $V0 'Status'
|
|
|
74096c |
+
|
|
|
74096c |
+#Add-brick with Increasing replica count
|
|
|
74096c |
+TEST $CLI_1 volume add-brick $V0 replica 3 $H3:$L3/${V0}1
|
|
|
74096c |
+EXPECT '1 x 3 = 3' volinfo_field $V0 'Number of Bricks'
|
|
|
74096c |
+
|
|
|
74096c |
+#Add-brick with Increasing replica count from same host should fail
|
|
|
74096c |
+TEST ! $CLI_1 volume add-brick $V0 replica 5 $H1:$L1/${V0}2 $H1:$L1/${V0}3
|
|
|
74096c |
+
|
|
|
74096c |
+#adding multiple bricks from same host should fail the brick order check
|
|
|
74096c |
+TEST ! $CLI_1 volume add-brick $V0 replica 3 $H1:$L1/${V0}{4..6} $H2:$L2/${V0}{7..9}
|
|
|
74096c |
+EXPECT '1 x 3 = 3' volinfo_field $V0 'Number of Bricks'
|
|
|
74096c |
+
|
|
|
74096c |
cleanup
|
|
|
74096c |
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
74096c |
index 545e688..d25fc8a 100644
|
|
|
74096c |
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
74096c |
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
74096c |
@@ -14908,6 +14908,10 @@ glusterd_check_brick_order(dict_t *dict, char *err_str, int32_t type,
|
|
|
74096c |
i = 0;
|
|
|
74096c |
ai_list_tmp1 = cds_list_entry(ai_list->list.next, addrinfo_list_t, list);
|
|
|
74096c |
|
|
|
74096c |
+ if (brick_count < sub_count) {
|
|
|
74096c |
+ sub_count = brick_count;
|
|
|
74096c |
+ }
|
|
|
74096c |
+
|
|
|
74096c |
/* Check for bad brick order */
|
|
|
74096c |
while (i < brick_count) {
|
|
|
74096c |
++i;
|
|
|
74096c |
--
|
|
|
74096c |
1.8.3.1
|
|
|
74096c |
|