|
|
887953 |
From ecb5c63d41daf98c3bca73d2ab24aa77e1b34886 Mon Sep 17 00:00:00 2001
|
|
|
887953 |
From: Sunny Kumar <sunkumar@redhat.com>
|
|
|
887953 |
Date: Mon, 17 Dec 2018 12:56:33 +0530
|
|
|
887953 |
Subject: [PATCH 480/493] geo-rep: Make slave volume read-only (by default)
|
|
|
887953 |
|
|
|
887953 |
Added a command to set "features.read-only" option
|
|
|
887953 |
to a default value "on" for slave volume.
|
|
|
887953 |
Changes are made in:
|
|
|
887953 |
$SRC//extras/hook-scripts/S56glusterd-geo-rep-create-post.sh
|
|
|
887953 |
for root geo-rep and
|
|
|
887953 |
$SRC/geo-replication/src/set_geo_rep_pem_keys.sh
|
|
|
887953 |
for non-root geo-rep.
|
|
|
887953 |
|
|
|
887953 |
Upstream patch : https://review.gluster.org/#/c/glusterfs/+/21739
|
|
|
887953 |
>Fixes: bz#1654187
|
|
|
887953 |
>Signed-off-by: Harpreet Kaur <hlalwani@redhat.com>
|
|
|
887953 |
|
|
|
887953 |
Change-Id: I15beeae3506f3f6b1dcba0a5c50b6344fd468c7c
|
|
|
887953 |
BUG: 1643370
|
|
|
887953 |
Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
|
|
|
887953 |
Reviewed-on: https://code.engineering.redhat.com/gerrit/158790
|
|
|
887953 |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
887953 |
Reviewed-by: Kotresh Hiremath Ravishankar <khiremat@redhat.com>
|
|
|
887953 |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
887953 |
---
|
|
|
887953 |
extras/hook-scripts/S56glusterd-geo-rep-create-post.sh | 1 +
|
|
|
887953 |
geo-replication/src/set_geo_rep_pem_keys.sh | 1 +
|
|
|
887953 |
tests/geo-rep.rc | 7 +++++++
|
|
|
887953 |
tests/geo-rep/georep-basic-dr-rsync.t | 3 +++
|
|
|
887953 |
tests/geo-rep/georep-basic-dr-tarssh.t | 3 +++
|
|
|
887953 |
5 files changed, 15 insertions(+)
|
|
|
887953 |
|
|
|
887953 |
diff --git a/extras/hook-scripts/S56glusterd-geo-rep-create-post.sh b/extras/hook-scripts/S56glusterd-geo-rep-create-post.sh
|
|
|
887953 |
index a5e472e..589c263 100755
|
|
|
887953 |
--- a/extras/hook-scripts/S56glusterd-geo-rep-create-post.sh
|
|
|
887953 |
+++ b/extras/hook-scripts/S56glusterd-geo-rep-create-post.sh
|
|
|
887953 |
@@ -90,5 +90,6 @@ if [ -f $pub_file ]; then
|
|
|
887953 |
ssh -p ${SSH_PORT} $slave_ip "mv $pub_file_tmp ${pub_file_dname}/${mastervol}_${slavevol}_${pub_file_bname}"
|
|
|
887953 |
ssh -p ${SSH_PORT} $slave_ip "gluster system:: copy file /geo-replication/${mastervol}_${slavevol}_common_secret.pem.pub > /dev/null"
|
|
|
887953 |
ssh -p ${SSH_PORT} $slave_ip "gluster system:: execute add_secret_pub root geo-replication/${mastervol}_${slavevol}_common_secret.pem.pub > /dev/null"
|
|
|
887953 |
+ ssh -p ${SSH_PORT} $slave_ip "gluster vol set ${slavevol} features.read-only on"
|
|
|
887953 |
fi
|
|
|
887953 |
fi
|
|
|
887953 |
diff --git a/geo-replication/src/set_geo_rep_pem_keys.sh b/geo-replication/src/set_geo_rep_pem_keys.sh
|
|
|
887953 |
index ae23f4f..8a43fa3 100755
|
|
|
887953 |
--- a/geo-replication/src/set_geo_rep_pem_keys.sh
|
|
|
887953 |
+++ b/geo-replication/src/set_geo_rep_pem_keys.sh
|
|
|
887953 |
@@ -47,6 +47,7 @@ function main()
|
|
|
887953 |
cp $home_dir/${COMMON_SECRET_PEM_PUB} ${GLUSTERD_WORKDIR}/geo-replication/
|
|
|
887953 |
gluster system:: copy file /geo-replication/${COMMON_SECRET_PEM_PUB}
|
|
|
887953 |
gluster system:: execute add_secret_pub $user geo-replication/${master_vol}_${slave_vol}_common_secret.pem.pub
|
|
|
887953 |
+ gluster vol set ${slave_vol} features.read-only on
|
|
|
887953 |
else
|
|
|
887953 |
echo "$home_dir/common_secret.pem.pub not present. Please run geo-replication command on master with push-pem option to generate the file"
|
|
|
887953 |
exit 1;
|
|
|
887953 |
diff --git a/tests/geo-rep.rc b/tests/geo-rep.rc
|
|
|
887953 |
index 1a44b4a..f9ab3fc 100644
|
|
|
887953 |
--- a/tests/geo-rep.rc
|
|
|
887953 |
+++ b/tests/geo-rep.rc
|
|
|
887953 |
@@ -230,3 +230,10 @@ function hardlink_rename_ok()
|
|
|
887953 |
fi
|
|
|
887953 |
return 0
|
|
|
887953 |
}
|
|
|
887953 |
+
|
|
|
887953 |
+function check_slave_read_only()
|
|
|
887953 |
+{
|
|
|
887953 |
+ volum=$1
|
|
|
887953 |
+ gluster volume info $1 | grep 'features.read-only: on'
|
|
|
887953 |
+ echo $?
|
|
|
887953 |
+}
|
|
|
887953 |
diff --git a/tests/geo-rep/georep-basic-dr-rsync.t b/tests/geo-rep/georep-basic-dr-rsync.t
|
|
|
887953 |
index 39da524..fd0c4aa 100644
|
|
|
887953 |
--- a/tests/geo-rep/georep-basic-dr-rsync.t
|
|
|
887953 |
+++ b/tests/geo-rep/georep-basic-dr-rsync.t
|
|
|
887953 |
@@ -57,6 +57,9 @@ EXPECT 4 check_status_num_rows "Created" #15
|
|
|
887953 |
#Enable_metavolume
|
|
|
887953 |
TEST $GEOREP_CLI $master $slave config use_meta_volume true
|
|
|
887953 |
|
|
|
887953 |
+#Verify "features.read-only" Option
|
|
|
887953 |
+EXPECT_WITHIN $GEO_REP_TIMEOUT 0 check_slave_read_only $GSV0
|
|
|
887953 |
+
|
|
|
887953 |
#Start_georep
|
|
|
887953 |
TEST $GEOREP_CLI $master $slave start
|
|
|
887953 |
|
|
|
887953 |
diff --git a/tests/geo-rep/georep-basic-dr-tarssh.t b/tests/geo-rep/georep-basic-dr-tarssh.t
|
|
|
887953 |
index 5f879db..5331df9 100644
|
|
|
887953 |
--- a/tests/geo-rep/georep-basic-dr-tarssh.t
|
|
|
887953 |
+++ b/tests/geo-rep/georep-basic-dr-tarssh.t
|
|
|
887953 |
@@ -62,6 +62,9 @@ TEST $GEOREP_CLI $master $slave config use_meta_volume true
|
|
|
887953 |
#Config tarssh as sync-engine
|
|
|
887953 |
TEST $GEOREP_CLI $master $slave config use_tarssh true
|
|
|
887953 |
|
|
|
887953 |
+#Verify "features.read-only" Option
|
|
|
887953 |
+EXPECT_WITHIN $GEO_REP_TIMEOUT 0 check_slave_read_only $GSV0
|
|
|
887953 |
+
|
|
|
887953 |
#Start_georep
|
|
|
887953 |
TEST $GEOREP_CLI $master $slave start
|
|
|
887953 |
|
|
|
887953 |
--
|
|
|
887953 |
1.8.3.1
|
|
|
887953 |
|