You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
157 lines
5.4 KiB
157 lines
5.4 KiB
3 years ago
|
From bffdcce7119f3ed68694df918e504cc241502835 Mon Sep 17 00:00:00 2001
|
||
|
From: Anuradha Talur <atalur@commvault.com>
|
||
|
Date: Mon, 19 Nov 2018 17:57:18 -0800
|
||
|
Subject: [PATCH 151/169] mgmt/glusterd: Make changes related to cloudsync
|
||
|
xlator
|
||
|
|
||
|
1) The placement of cloudsync xlator has been changed
|
||
|
to make it shard xlator's child. If cloudsync has to
|
||
|
work with shard in the graph, it needs to be child of shard.
|
||
|
|
||
|
backport of: https://review.gluster.org/#/c/glusterfs/+/21681/
|
||
|
|
||
|
> Change-Id: Ib55424fdcb7ce8edae9f19b8a6e3d3ba86c1f0c4
|
||
|
> fixes: bz#1642168
|
||
|
> Signed-off-by: Anuradha Talur <atalur@commvault.com>
|
||
|
|
||
|
Change-Id: I68fd43b2c559cc2d9f05e1ab19784b174233d690
|
||
|
Signed-off-by: Susant Palai <spalai@redhat.com>
|
||
|
Reviewed-on: https://code.engineering.redhat.com/gerrit/172190
|
||
|
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
||
|
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
||
|
---
|
||
|
tests/basic/glusterd/check-cloudsync-ancestry.t | 48 +++++++++++++++++++++++++
|
||
|
tests/volume.rc | 21 +++++++++++
|
||
|
xlators/mgmt/glusterd/src/glusterd-volgen.c | 24 ++++++-------
|
||
|
3 files changed, 81 insertions(+), 12 deletions(-)
|
||
|
create mode 100644 tests/basic/glusterd/check-cloudsync-ancestry.t
|
||
|
|
||
|
diff --git a/tests/basic/glusterd/check-cloudsync-ancestry.t b/tests/basic/glusterd/check-cloudsync-ancestry.t
|
||
|
new file mode 100644
|
||
|
index 0000000..ff6ffee
|
||
|
--- /dev/null
|
||
|
+++ b/tests/basic/glusterd/check-cloudsync-ancestry.t
|
||
|
@@ -0,0 +1,48 @@
|
||
|
+#!/bin/bash
|
||
|
+
|
||
|
+. $(dirname $0)/../../include.rc
|
||
|
+. $(dirname $0)/../../volume.rc
|
||
|
+
|
||
|
+# When shard and cloudsync xlators enabled on a volume, shard xlator
|
||
|
+# should be an ancestor of cloudsync. This testcase is to check this condition.
|
||
|
+
|
||
|
+cleanup;
|
||
|
+TEST glusterd
|
||
|
+TEST pidof glusterd
|
||
|
+TEST $CLI volume create $V0 $H0:$B0/b1 $H0:$B0/b2 $H0:$B0/b3
|
||
|
+
|
||
|
+volfile=$(gluster system:: getwd)"/vols/$V0/trusted-$V0.tcp-fuse.vol"
|
||
|
+
|
||
|
+#Test that both shard and cloudsync are not loaded
|
||
|
+EXPECT "N" volgen_volume_exists $volfile $V0-shard features shard
|
||
|
+EXPECT "N" volgen_volume_exists $volfile $V0-cloudsync features cloudsync
|
||
|
+
|
||
|
+#Enable shard and cloudsync in that order and check if volfile is correct
|
||
|
+TEST $CLI volume set $V0 shard on
|
||
|
+TEST $CLI volume set $V0 cloudsync on
|
||
|
+
|
||
|
+#Test that both shard and cloudsync are loaded
|
||
|
+EXPECT "Y" volgen_volume_exists $volfile $V0-shard features shard
|
||
|
+EXPECT "Y" volgen_volume_exists $volfile $V0-cloudsync features cloudsync
|
||
|
+
|
||
|
+EXPECT "Y" volgen_check_ancestry $volfile features shard features cloudsync
|
||
|
+
|
||
|
+#Disable shard and cloudsync
|
||
|
+TEST $CLI volume set $V0 shard off
|
||
|
+TEST $CLI volume set $V0 cloudsync off
|
||
|
+
|
||
|
+#Test that both shard and cloudsync are not loaded
|
||
|
+EXPECT "N" volgen_volume_exists $volfile $V0-shard features shard
|
||
|
+EXPECT "N" volgen_volume_exists $volfile $V0-cloudsync features cloudsync
|
||
|
+
|
||
|
+#Enable cloudsync and shard in that order and check if volfile is correct
|
||
|
+TEST $CLI volume set $V0 cloudsync on
|
||
|
+TEST $CLI volume set $V0 shard on
|
||
|
+
|
||
|
+#Test that both shard and cloudsync are loaded
|
||
|
+EXPECT "Y" volgen_volume_exists $volfile $V0-shard features shard
|
||
|
+EXPECT "Y" volgen_volume_exists $volfile $V0-cloudsync features cloudsync
|
||
|
+
|
||
|
+EXPECT "Y" volgen_check_ancestry $volfile features shard features cloudsync
|
||
|
+
|
||
|
+cleanup;
|
||
|
diff --git a/tests/volume.rc b/tests/volume.rc
|
||
|
index b326098..a0ea3b8 100644
|
||
|
--- a/tests/volume.rc
|
||
|
+++ b/tests/volume.rc
|
||
|
@@ -891,3 +891,24 @@ function check_changelog_op {
|
||
|
|
||
|
$PYTHON $(dirname $0)/../../utils/changelogparser.py ${clog_path}/CHANGELOG | grep "$op" | wc -l
|
||
|
}
|
||
|
+
|
||
|
+function volgen_check_ancestry {
|
||
|
+ #Returns Y if ancestor_xl is an ancestor of $child_xl according to the volfile
|
||
|
+ local volfile="$1"
|
||
|
+
|
||
|
+ local child_xl_type="$2"
|
||
|
+ local child_xl="$3"
|
||
|
+
|
||
|
+ local ancestor_xl_type="$4"
|
||
|
+ local ancestor_xl="$5"
|
||
|
+
|
||
|
+ child_linenum=$(awk '/type $child_xl_type\/$child_xl/ {print FNR}' $volfile)
|
||
|
+ ancestor_linenum=$(awk '/type $ancestor_xl_type\/$ancestor_xl/ {print FNR}' $volfile)
|
||
|
+
|
||
|
+ if [ $child_linenum -lt $ancestor_linenum ];
|
||
|
+ then
|
||
|
+ echo "Y"
|
||
|
+ else
|
||
|
+ echo "N"
|
||
|
+ fi
|
||
|
+}
|
||
|
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
|
||
|
index 77aa705..8b58d40 100644
|
||
|
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
|
||
|
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
|
||
|
@@ -4360,6 +4360,18 @@ client_graph_builder(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
|
||
|
"tcp", set_dict);
|
||
|
}
|
||
|
|
||
|
+ ret = dict_get_str_boolean(set_dict, "features.cloudsync", _gf_false);
|
||
|
+ if (ret == -1)
|
||
|
+ goto out;
|
||
|
+
|
||
|
+ if (ret) {
|
||
|
+ xl = volgen_graph_add(graph, "features/cloudsync", volname);
|
||
|
+ if (!xl) {
|
||
|
+ ret = -1;
|
||
|
+ goto out;
|
||
|
+ }
|
||
|
+ }
|
||
|
+
|
||
|
ret = dict_get_str_boolean(set_dict, "features.shard", _gf_false);
|
||
|
if (ret == -1)
|
||
|
goto out;
|
||
|
@@ -4567,18 +4579,6 @@ client_graph_builder(volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
|
||
|
if (ret)
|
||
|
return -1;
|
||
|
|
||
|
- ret = dict_get_str_boolean(set_dict, "features.cloudsync", _gf_false);
|
||
|
- if (ret == -1)
|
||
|
- goto out;
|
||
|
-
|
||
|
- if (ret) {
|
||
|
- xl = volgen_graph_add(graph, "features/cloudsync", volname);
|
||
|
- if (!xl) {
|
||
|
- ret = -1;
|
||
|
- goto out;
|
||
|
- }
|
||
|
- }
|
||
|
-
|
||
|
/* if the client is part of 'gfproxyd' server, then we need to keep the
|
||
|
volume name as 'gfproxyd-<volname>', for better portmapper options */
|
||
|
subvol = volname;
|
||
|
--
|
||
|
1.8.3.1
|
||
|
|