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