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