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