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