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