|
|
74096c |
From 2d172144810956225eac3599c943416c4a7e25d0 Mon Sep 17 00:00:00 2001
|
|
|
74096c |
From: Ravishankar N <ravishankar@redhat.com>
|
|
|
74096c |
Date: Tue, 8 Dec 2020 20:30:23 +0530
|
|
|
74096c |
Subject: [PATCH 489/511] glusterd: fix bug in enabling granular-entry-heal
|
|
|
74096c |
|
|
|
74096c |
Upstream patch details:
|
|
|
74096c |
/------------------------------------------------------------------------------/
|
|
|
74096c |
commit f5e1eb87d4af44be3b317b7f99ab88f89c2f0b1a meant to enable the
|
|
|
74096c |
volume option only for replica volumes but inadvertently enabled
|
|
|
74096c |
it for all volume types. Fixing it now.
|
|
|
74096c |
|
|
|
74096c |
Also found a bug in glusterd where disabling the option on plain
|
|
|
74096c |
distribute was succeeding even though setting it in the fist place
|
|
|
74096c |
fails. Fixed that too.
|
|
|
74096c |
|
|
|
74096c |
>Fixes: #1483
|
|
|
74096c |
>Change-Id: Icb6c169a8eec44cc4fb4dd636405d3b3485e91b4
|
|
|
74096c |
>Reported-by: Sheetal Pamecha <spamecha@redhat.com>
|
|
|
74096c |
>Signed-off-by: Ravishankar N <ravishankar@redhat.com>
|
|
|
74096c |
Upstream Patch: https://github.com/gluster/glusterfs/pull/1752
|
|
|
74096c |
/------------------------------------------------------------------------------/
|
|
|
74096c |
|
|
|
74096c |
BUG: 1890506
|
|
|
74096c |
Change-Id: Id63655dac08d2cfda4899d7ee0efe96e72cd6986
|
|
|
74096c |
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
|
|
|
74096c |
Reviewed-on: https://code.engineering.redhat.com/gerrit/220556
|
|
|
74096c |
Tested-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
74096c |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
74096c |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
74096c |
---
|
|
|
74096c |
tests/basic/afr/granular-esh/cli.t | 30 ++++++++++++++++++++-----
|
|
|
74096c |
xlators/mgmt/glusterd/src/glusterd-utils.c | 3 ++-
|
|
|
74096c |
xlators/mgmt/glusterd/src/glusterd-volume-ops.c | 12 +++++-----
|
|
|
74096c |
3 files changed, 34 insertions(+), 11 deletions(-)
|
|
|
74096c |
|
|
|
74096c |
diff --git a/tests/basic/afr/granular-esh/cli.t b/tests/basic/afr/granular-esh/cli.t
|
|
|
74096c |
index 995d93e..5ab2e39 100644
|
|
|
74096c |
--- a/tests/basic/afr/granular-esh/cli.t
|
|
|
74096c |
+++ b/tests/basic/afr/granular-esh/cli.t
|
|
|
74096c |
@@ -11,25 +11,38 @@ TESTS_EXPECTED_IN_LOOP=4
|
|
|
74096c |
TEST glusterd
|
|
|
74096c |
TEST pidof glusterd
|
|
|
74096c |
|
|
|
74096c |
-TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0,1}
|
|
|
74096c |
-# Test that enabling the option should work on a newly created volume
|
|
|
74096c |
-TEST $CLI volume set $V0 cluster.granular-entry-heal on
|
|
|
74096c |
-TEST $CLI volume set $V0 cluster.granular-entry-heal off
|
|
|
74096c |
-
|
|
|
74096c |
#########################
|
|
|
74096c |
##### DISPERSE TEST #####
|
|
|
74096c |
#########################
|
|
|
74096c |
# Execute the same command on a disperse volume and make sure it fails.
|
|
|
74096c |
TEST $CLI volume create $V1 disperse 3 redundancy 1 $H0:$B0/${V1}{0,1,2}
|
|
|
74096c |
+EXPECT "no" volume_get_field $V1 cluster.granular-entry-heal
|
|
|
74096c |
+TEST $CLI volume start $V1
|
|
|
74096c |
+TEST ! $CLI volume heal $V1 granular-entry-heal enable
|
|
|
74096c |
+TEST ! $CLI volume heal $V1 granular-entry-heal disable
|
|
|
74096c |
+
|
|
|
74096c |
+TEST $CLI volume stop $V1
|
|
|
74096c |
+TEST $CLI volume delete $V1
|
|
|
74096c |
+
|
|
|
74096c |
+#########################
|
|
|
74096c |
+##### PLAIN DISTRIBUTE TEST #####
|
|
|
74096c |
+#########################
|
|
|
74096c |
+# Execute the same command on a distribute volume and make sure it fails.
|
|
|
74096c |
+TEST $CLI volume create $V1 $H0:$B0/${V1}{0,1,2}
|
|
|
74096c |
+EXPECT "no" volume_get_field $V1 cluster.granular-entry-heal
|
|
|
74096c |
TEST $CLI volume start $V1
|
|
|
74096c |
TEST ! $CLI volume heal $V1 granular-entry-heal enable
|
|
|
74096c |
TEST ! $CLI volume heal $V1 granular-entry-heal disable
|
|
|
74096c |
+TEST $CLI volume stop $V1
|
|
|
74096c |
+TEST $CLI volume delete $V1
|
|
|
74096c |
|
|
|
74096c |
#######################
|
|
|
74096c |
###### TIER TEST ######
|
|
|
74096c |
#######################
|
|
|
74096c |
# Execute the same command on a disperse + replicate tiered volume and make
|
|
|
74096c |
# sure the option is set on the replicate leg of the volume
|
|
|
74096c |
+TEST $CLI volume create $V1 disperse 3 redundancy 1 $H0:$B0/${V1}{0,1,2}
|
|
|
74096c |
+TEST $CLI volume start $V1
|
|
|
74096c |
TEST $CLI volume tier $V1 attach replica 2 $H0:$B0/${V1}{3,4}
|
|
|
74096c |
TEST $CLI volume heal $V1 granular-entry-heal enable
|
|
|
74096c |
EXPECT "enable" volume_get_field $V1 cluster.granular-entry-heal
|
|
|
74096c |
@@ -52,10 +65,17 @@ TEST kill_brick $V1 $H0 $B0/${V1}3
|
|
|
74096c |
# failed.
|
|
|
74096c |
TEST ! $CLI volume heal $V1 granular-entry-heal enable
|
|
|
74096c |
EXPECT "disable" volume_get_field $V1 cluster.granular-entry-heal
|
|
|
74096c |
+TEST $CLI volume stop $V1
|
|
|
74096c |
+TEST $CLI volume delete $V1
|
|
|
74096c |
|
|
|
74096c |
######################
|
|
|
74096c |
### REPLICATE TEST ###
|
|
|
74096c |
######################
|
|
|
74096c |
+TEST $CLI volume create $V0 replica 3 $H0:$B0/${V0}{0,1,2}
|
|
|
74096c |
+EXPECT "on" volume_get_field $V0 cluster.granular-entry-heal
|
|
|
74096c |
+# Test that enabling the option should work on a newly created volume
|
|
|
74096c |
+TEST $CLI volume set $V0 cluster.granular-entry-heal on
|
|
|
74096c |
+TEST $CLI volume set $V0 cluster.granular-entry-heal off
|
|
|
74096c |
TEST $CLI volume start $V0
|
|
|
74096c |
TEST $CLI volume set $V0 cluster.data-self-heal off
|
|
|
74096c |
TEST $CLI volume set $V0 cluster.metadata-self-heal off
|
|
|
74096c |
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
74096c |
index bd17a82..ad3750e 100644
|
|
|
74096c |
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
74096c |
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
74096c |
@@ -13183,7 +13183,8 @@ glusterd_enable_default_options(glusterd_volinfo_t *volinfo, char *option)
|
|
|
74096c |
}
|
|
|
74096c |
|
|
|
74096c |
if ((conf->op_version >= GD_OP_VERSION_7_1) &&
|
|
|
74096c |
- (volinfo->status == GLUSTERD_STATUS_NONE)) {
|
|
|
74096c |
+ (volinfo->status == GLUSTERD_STATUS_NONE) &&
|
|
|
74096c |
+ (volinfo->type == GF_CLUSTER_TYPE_REPLICATE)) {
|
|
|
74096c |
ret = dict_set_dynstr_with_alloc(volinfo->dict,
|
|
|
74096c |
"cluster.granular-entry-heal", "on");
|
|
|
74096c |
if (ret) {
|
|
|
74096c |
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
|
|
|
74096c |
index 134b04c..09e6ead 100644
|
|
|
74096c |
--- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
|
|
|
74096c |
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c
|
|
|
74096c |
@@ -621,11 +621,13 @@ glusterd_handle_heal_options_enable_disable(rpcsvc_request_t *req, dict_t *dict,
|
|
|
74096c |
goto out;
|
|
|
74096c |
}
|
|
|
74096c |
|
|
|
74096c |
- if (((heal_op == GF_SHD_OP_GRANULAR_ENTRY_HEAL_ENABLE) ||
|
|
|
74096c |
- (heal_op == GF_SHD_OP_GRANULAR_ENTRY_HEAL_DISABLE)) &&
|
|
|
74096c |
- (volinfo->type == GF_CLUSTER_TYPE_DISPERSE)) {
|
|
|
74096c |
- ret = -1;
|
|
|
74096c |
- goto out;
|
|
|
74096c |
+ if ((heal_op == GF_SHD_OP_GRANULAR_ENTRY_HEAL_ENABLE) ||
|
|
|
74096c |
+ (heal_op == GF_SHD_OP_GRANULAR_ENTRY_HEAL_DISABLE)) {
|
|
|
74096c |
+ if ((volinfo->type != GF_CLUSTER_TYPE_REPLICATE) &&
|
|
|
74096c |
+ (volinfo->type != GF_CLUSTER_TYPE_TIER)) {
|
|
|
74096c |
+ ret = -1;
|
|
|
74096c |
+ goto out;
|
|
|
74096c |
+ }
|
|
|
74096c |
}
|
|
|
74096c |
|
|
|
74096c |
if ((heal_op == GF_SHD_OP_HEAL_ENABLE) ||
|
|
|
74096c |
--
|
|
|
74096c |
1.8.3.1
|
|
|
74096c |
|