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