|
|
e3c68b |
From 2b1738402276f43d7cb64542b74cb50145e46d77 Mon Sep 17 00:00:00 2001
|
|
|
e3c68b |
From: Kotresh HR <khiremat@redhat.com>
|
|
|
e3c68b |
Date: Wed, 16 Oct 2019 14:25:47 +0530
|
|
|
e3c68b |
Subject: [PATCH 309/309] geo-rep: Fix config upgrade on non-participating node
|
|
|
e3c68b |
|
|
|
e3c68b |
After upgrade, if the config files are of old format, it
|
|
|
e3c68b |
gets migrated to new format. Monitor process migrates it.
|
|
|
e3c68b |
Since monitor doesn't run on nodes where bricks are not
|
|
|
e3c68b |
hosted, it doesn't get migrated there. So this patch fixes
|
|
|
e3c68b |
the config upgrade on nodes which doesn't host bricks.
|
|
|
e3c68b |
This happens during config either on get/set/reset.
|
|
|
e3c68b |
|
|
|
e3c68b |
Backport of:
|
|
|
e3c68b |
> Patch: https://review.gluster.org/23555
|
|
|
e3c68b |
> Change-Id: Ibade2f2310b0f3affea21a3baa1ae0eb71162cba
|
|
|
e3c68b |
> Signed-off-by: Kotresh HR <khiremat@redhat.com>
|
|
|
e3c68b |
> fixes: bz#1762220
|
|
|
e3c68b |
|
|
|
e3c68b |
Change-Id: Ibade2f2310b0f3affea21a3baa1ae0eb71162cba
|
|
|
e3c68b |
Signed-off-by: Kotresh HR <khiremat@redhat.com>
|
|
|
e3c68b |
BUG: 1760939
|
|
|
e3c68b |
Reviewed-on: https://code.engineering.redhat.com/gerrit/183461
|
|
|
e3c68b |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
e3c68b |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
e3c68b |
---
|
|
|
e3c68b |
geo-replication/syncdaemon/gsyncd.py | 3 +-
|
|
|
e3c68b |
tests/00-geo-rep/georep-config-upgrade.t | 132 +++++++++++++++++++++++++++++++
|
|
|
e3c68b |
tests/00-geo-rep/gsyncd.conf.old | 47 +++++++++++
|
|
|
e3c68b |
3 files changed, 181 insertions(+), 1 deletion(-)
|
|
|
e3c68b |
create mode 100644 tests/00-geo-rep/georep-config-upgrade.t
|
|
|
e3c68b |
create mode 100644 tests/00-geo-rep/gsyncd.conf.old
|
|
|
e3c68b |
|
|
|
e3c68b |
diff --git a/geo-replication/syncdaemon/gsyncd.py b/geo-replication/syncdaemon/gsyncd.py
|
|
|
e3c68b |
index 6ae5269..7b48d82 100644
|
|
|
e3c68b |
--- a/geo-replication/syncdaemon/gsyncd.py
|
|
|
e3c68b |
+++ b/geo-replication/syncdaemon/gsyncd.py
|
|
|
e3c68b |
@@ -255,7 +255,8 @@ def main():
|
|
|
e3c68b |
if args.subcmd == "slave":
|
|
|
e3c68b |
override_from_args = True
|
|
|
e3c68b |
|
|
|
e3c68b |
- if args.subcmd == "monitor":
|
|
|
e3c68b |
+ if config_file is not None and \
|
|
|
e3c68b |
+ args.subcmd in ["monitor", "config-get", "config-set", "config-reset"]:
|
|
|
e3c68b |
ret = gconf.is_config_file_old(config_file, args.master, extra_tmpl_args["slavevol"])
|
|
|
e3c68b |
if ret is not None:
|
|
|
e3c68b |
gconf.config_upgrade(config_file, ret)
|
|
|
e3c68b |
diff --git a/tests/00-geo-rep/georep-config-upgrade.t b/tests/00-geo-rep/georep-config-upgrade.t
|
|
|
e3c68b |
new file mode 100644
|
|
|
e3c68b |
index 0000000..557461c
|
|
|
e3c68b |
--- /dev/null
|
|
|
e3c68b |
+++ b/tests/00-geo-rep/georep-config-upgrade.t
|
|
|
e3c68b |
@@ -0,0 +1,132 @@
|
|
|
e3c68b |
+#!/bin/bash
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+. $(dirname $0)/../include.rc
|
|
|
e3c68b |
+. $(dirname $0)/../volume.rc
|
|
|
e3c68b |
+. $(dirname $0)/../geo-rep.rc
|
|
|
e3c68b |
+. $(dirname $0)/../env.rc
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+SCRIPT_TIMEOUT=300
|
|
|
e3c68b |
+OLD_CONFIG_PATH=$(dirname $0)/gsyncd.conf.old
|
|
|
e3c68b |
+WORKING_DIR=/var/lib/glusterd/geo-replication/master_127.0.0.1_slave
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+##Cleanup and start glusterd
|
|
|
e3c68b |
+cleanup;
|
|
|
e3c68b |
+TEST glusterd;
|
|
|
e3c68b |
+TEST pidof glusterd
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+##Variables
|
|
|
e3c68b |
+GEOREP_CLI="$CLI volume geo-replication"
|
|
|
e3c68b |
+master=$GMV0
|
|
|
e3c68b |
+SH0="127.0.0.1"
|
|
|
e3c68b |
+slave=${SH0}::${GSV0}
|
|
|
e3c68b |
+num_active=2
|
|
|
e3c68b |
+num_passive=2
|
|
|
e3c68b |
+master_mnt=$M0
|
|
|
e3c68b |
+slave_mnt=$M1
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+############################################################
|
|
|
e3c68b |
+#SETUP VOLUMES AND GEO-REPLICATION
|
|
|
e3c68b |
+############################################################
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+##create_and_start_master_volume
|
|
|
e3c68b |
+TEST $CLI volume create $GMV0 replica 2 $H0:$B0/${GMV0}{1,2,3,4};
|
|
|
e3c68b |
+TEST $CLI volume start $GMV0
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+##create_and_start_slave_volume
|
|
|
e3c68b |
+TEST $CLI volume create $GSV0 replica 2 $H0:$B0/${GSV0}{1,2,3,4};
|
|
|
e3c68b |
+TEST $CLI volume start $GSV0
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+##Create, start and mount meta_volume
|
|
|
e3c68b |
+TEST $CLI volume create $META_VOL replica 3 $H0:$B0/${META_VOL}{1,2,3};
|
|
|
e3c68b |
+TEST $CLI volume start $META_VOL
|
|
|
e3c68b |
+TEST mkdir -p $META_MNT
|
|
|
e3c68b |
+TEST glusterfs -s $H0 --volfile-id $META_VOL $META_MNT
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+##Mount master
|
|
|
e3c68b |
+TEST glusterfs -s $H0 --volfile-id $GMV0 $M0
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+##Mount slave
|
|
|
e3c68b |
+TEST glusterfs -s $H0 --volfile-id $GSV0 $M1
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+############################################################
|
|
|
e3c68b |
+#BASIC GEO-REPLICATION TESTS
|
|
|
e3c68b |
+############################################################
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+#Create geo-rep session
|
|
|
e3c68b |
+TEST create_georep_session $master $slave
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+#Config gluster-command-dir
|
|
|
e3c68b |
+TEST $GEOREP_CLI $master $slave config gluster-command-dir ${GLUSTER_CMD_DIR}
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+#Config gluster-command-dir
|
|
|
e3c68b |
+TEST $GEOREP_CLI $master $slave config slave-gluster-command-dir ${GLUSTER_CMD_DIR}
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+#Enable_metavolume
|
|
|
e3c68b |
+TEST $GEOREP_CLI $master $slave config use_meta_volume true
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+#Wait for common secret pem file to be created
|
|
|
e3c68b |
+EXPECT_WITHIN $GEO_REP_TIMEOUT 0 check_common_secret_file
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+#Verify the keys are distributed
|
|
|
e3c68b |
+EXPECT_WITHIN $GEO_REP_TIMEOUT 0 check_keys_distributed
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+#Start_georep
|
|
|
e3c68b |
+TEST $GEOREP_CLI $master $slave start
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+EXPECT_WITHIN $GEO_REP_TIMEOUT 2 check_status_num_rows "Active"
|
|
|
e3c68b |
+EXPECT_WITHIN $GEO_REP_TIMEOUT 2 check_status_num_rows "Passive"
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+TEST $GEOREP_CLI $master $slave config sync-method tarssh
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+#Stop Geo-rep
|
|
|
e3c68b |
+TEST $GEOREP_CLI $master $slave stop
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+#Copy old config file
|
|
|
e3c68b |
+mv -f $WORKING_DIR/gsyncd.conf $WORKING_DIR/gsyncd.conf.org
|
|
|
e3c68b |
+cp -p $OLD_CONFIG_PATH $WORKING_DIR/gsyncd.conf
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+#Check if config get all updates config_file
|
|
|
e3c68b |
+TEST ! grep "sync-method" $WORKING_DIR/gsyncd.conf
|
|
|
e3c68b |
+TEST $GEOREP_CLI $master $slave config
|
|
|
e3c68b |
+TEST grep "sync-method" $WORKING_DIR/gsyncd.conf
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+#Check if config get updates config_file
|
|
|
e3c68b |
+rm -f $WORKING_DIR/gsyncd.conf
|
|
|
e3c68b |
+cp -p $OLD_CONFIG_PATH $WORKING_DIR/gsyncd.conf
|
|
|
e3c68b |
+TEST ! grep "sync-method" $WORKING_DIR/gsyncd.conf
|
|
|
e3c68b |
+TEST $GEOREP_CLI $master $slave config sync-method
|
|
|
e3c68b |
+TEST grep "sync-method" $WORKING_DIR/gsyncd.conf
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+#Check if config set updates config_file
|
|
|
e3c68b |
+rm -f $WORKING_DIR/gsyncd.conf
|
|
|
e3c68b |
+cp -p $OLD_CONFIG_PATH $WORKING_DIR/gsyncd.conf
|
|
|
e3c68b |
+TEST ! grep "sync-method" $WORKING_DIR/gsyncd.conf
|
|
|
e3c68b |
+TEST $GEOREP_CLI $master $slave config sync-xattrs false
|
|
|
e3c68b |
+TEST grep "sync-method" $WORKING_DIR/gsyncd.conf
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+#Check if config reset updates config_file
|
|
|
e3c68b |
+rm -f $WORKING_DIR/gsyncd.conf
|
|
|
e3c68b |
+cp -p $OLD_CONFIG_PATH $WORKING_DIR/gsyncd.conf
|
|
|
e3c68b |
+TEST ! grep "sync-method" $WORKING_DIR/gsyncd.conf
|
|
|
e3c68b |
+TEST $GEOREP_CLI $master $slave config \!sync-xattrs
|
|
|
e3c68b |
+TEST grep "sync-method" $WORKING_DIR/gsyncd.conf
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+#Check if geo-rep start updates config_file
|
|
|
e3c68b |
+rm -f $WORKING_DIR/gsyncd.conf
|
|
|
e3c68b |
+cp -p $OLD_CONFIG_PATH $WORKING_DIR/gsyncd.conf
|
|
|
e3c68b |
+TEST ! grep "sync-method" $WORKING_DIR/gsyncd.conf
|
|
|
e3c68b |
+TEST $GEOREP_CLI $master $slave start
|
|
|
e3c68b |
+TEST grep "sync-method" $WORKING_DIR/gsyncd.conf
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+#Stop geo-rep
|
|
|
e3c68b |
+TEST $GEOREP_CLI $master $slave stop
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+#Delete Geo-rep
|
|
|
e3c68b |
+TEST $GEOREP_CLI $master $slave delete
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+#Cleanup authorized keys
|
|
|
e3c68b |
+sed -i '/^command=.*SSH_ORIGINAL_COMMAND#.*/d' ~/.ssh/authorized_keys
|
|
|
e3c68b |
+sed -i '/^command=.*gsyncd.*/d' ~/.ssh/authorized_keys
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+cleanup;
|
|
|
e3c68b |
+#G_TESTDEF_TEST_STATUS_NETBSD7=BAD_TEST,BUG=000000
|
|
|
e3c68b |
diff --git a/tests/00-geo-rep/gsyncd.conf.old b/tests/00-geo-rep/gsyncd.conf.old
|
|
|
e3c68b |
new file mode 100644
|
|
|
e3c68b |
index 0000000..519acaf
|
|
|
e3c68b |
--- /dev/null
|
|
|
e3c68b |
+++ b/tests/00-geo-rep/gsyncd.conf.old
|
|
|
e3c68b |
@@ -0,0 +1,47 @@
|
|
|
e3c68b |
+[__meta__]
|
|
|
e3c68b |
+version = 2.0
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+[peersrx . .]
|
|
|
e3c68b |
+remote_gsyncd = /usr/local/libexec/glusterfs/gsyncd
|
|
|
e3c68b |
+georep_session_working_dir = /var/lib/glusterd/geo-replication/${mastervol}_${remotehost}_${slavevol}/
|
|
|
e3c68b |
+ssh_command_tar = ssh -oPasswordAuthentication=no -oStrictHostKeyChecking=no -i /var/lib/glusterd/geo-replication/tar_ssh.pem
|
|
|
e3c68b |
+changelog_log_file = /var/log/glusterfs/geo-replication/${mastervol}/${eSlave}${local_id}-changes.log
|
|
|
e3c68b |
+working_dir = /var/lib/misc/glusterfsd/${mastervol}/${eSlave}
|
|
|
e3c68b |
+ignore_deletes = false
|
|
|
e3c68b |
+pid_file = /var/lib/glusterd/geo-replication/${mastervol}_${remotehost}_${slavevol}/monitor.pid
|
|
|
e3c68b |
+state_file = /var/lib/glusterd/geo-replication/${mastervol}_${remotehost}_${slavevol}/monitor.status
|
|
|
e3c68b |
+gluster_command_dir = /usr/local/sbin/
|
|
|
e3c68b |
+gluster_params = aux-gfid-mount acl
|
|
|
e3c68b |
+ssh_command = ssh -oPasswordAuthentication=no -oStrictHostKeyChecking=no -i /var/lib/glusterd/geo-replication/secret.pem
|
|
|
e3c68b |
+state_detail_file = /var/lib/glusterd/geo-replication/${mastervol}_${remotehost}_${slavevol}/${eSlave}-detail.status
|
|
|
e3c68b |
+state_socket_unencoded = /var/lib/glusterd/geo-replication/${mastervol}_${remotehost}_${slavevol}/${eSlave}.socket
|
|
|
e3c68b |
+socketdir = /var/run/gluster
|
|
|
e3c68b |
+log_file = /var/log/glusterfs/geo-replication/${mastervol}/${eSlave}.log
|
|
|
e3c68b |
+gluster_log_file = /var/log/glusterfs/geo-replication/${mastervol}/${eSlave}${local_id}.gluster.log
|
|
|
e3c68b |
+special_sync_mode = partial
|
|
|
e3c68b |
+change_detector = changelog
|
|
|
e3c68b |
+pid-file = /var/lib/glusterd/geo-replication/${mastervol}_${remotehost}_${slavevol}/monitor.pid
|
|
|
e3c68b |
+state-file = /var/lib/glusterd/geo-replication/${mastervol}_${remotehost}_${slavevol}/monitor.status
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+[__section_order__]
|
|
|
e3c68b |
+peersrx . . = 0
|
|
|
e3c68b |
+peersrx . %5essh%3a = 2
|
|
|
e3c68b |
+peersrx . = 3
|
|
|
e3c68b |
+peers master slave = 4
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+[peersrx . %5Essh%3A]
|
|
|
e3c68b |
+remote_gsyncd = /nonexistent/gsyncd
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+[peersrx .]
|
|
|
e3c68b |
+gluster_command_dir = /usr/local/sbin/
|
|
|
e3c68b |
+gluster_params = aux-gfid-mount acl
|
|
|
e3c68b |
+log_file = /var/log/glusterfs/geo-replication-slaves/${session_owner}:${local_node}${local_id}.${slavevol}.log
|
|
|
e3c68b |
+log_file_mbr = /var/log/glusterfs/geo-replication-slaves/mbr/${session_owner}:${local_node}${local_id}.${slavevol}.log
|
|
|
e3c68b |
+gluster_log_file = /var/log/glusterfs/geo-replication-slaves/${session_owner}:${local_node}${local_id}.${slavevol}.gluster.log
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+[peers master slave]
|
|
|
e3c68b |
+session_owner = 0732cbd1-3ec5-4920-ab0d-aa5a896d5214
|
|
|
e3c68b |
+master.stime_xattr_name = trusted.glusterfs.0732cbd1-3ec5-4920-ab0d-aa5a896d5214.07a9005c-ace4-4f67-b3c0-73938fb236c4.stime
|
|
|
e3c68b |
+volume_id = 0732cbd1-3ec5-4920-ab0d-aa5a896d5214
|
|
|
e3c68b |
+use_tarssh = true
|
|
|
e3c68b |
+
|
|
|
e3c68b |
--
|
|
|
e3c68b |
1.8.3.1
|
|
|
e3c68b |
|