|
|
12a457 |
From 64938830eced93fe083043064ed34521d56b5b3b Mon Sep 17 00:00:00 2001
|
|
|
12a457 |
From: Saravanakumar Arumugam <sarumuga@redhat.com>
|
|
|
12a457 |
Date: Mon, 30 May 2016 17:34:24 +0530
|
|
|
12a457 |
Subject: [PATCH 178/178] geo-rep: update peers section in gsyncd conf
|
|
|
12a457 |
|
|
|
12a457 |
Problem:
|
|
|
12a457 |
Once Slave volume uuid is involved as part of a geo-rep session, it is
|
|
|
12a457 |
possible to create the same geo-rep session with different (slave)host.
|
|
|
12a457 |
|
|
|
12a457 |
But, it reflects default values for geo-rep configuration values originally
|
|
|
12a457 |
configured for old geo-rep session.
|
|
|
12a457 |
Reason is, slave host is used while saving config options in gsyncd.conf.
|
|
|
12a457 |
With new slave host, it is not possible to retrieve those config values.
|
|
|
12a457 |
|
|
|
12a457 |
Solution:
|
|
|
12a457 |
Remove slave host related information from gsyncd.conf and have only master
|
|
|
12a457 |
volume and slave volume as part of peers section.
|
|
|
12a457 |
|
|
|
12a457 |
Also, during upgrade from old geo-rep session, update peers section to
|
|
|
12a457 |
reflect only master volume and slave volume.
|
|
|
12a457 |
|
|
|
12a457 |
Change-Id: I7debf35a09a28d030b706b0c3e5d82c9b0467d0e
|
|
|
12a457 |
BUG: 1340383
|
|
|
12a457 |
Reviewed-on: http://review.gluster.org/#/c/14558
|
|
|
12a457 |
Reviewed-on: http://review.gluster.org/#/c/14565
|
|
|
12a457 |
Reviewed-on: http://review.gluster.org/#/c/14566
|
|
|
12a457 |
Signed-off-by: Saravanakumar Arumugam <sarumuga@redhat.com>
|
|
|
12a457 |
Reviewed-on: https://code.engineering.redhat.com/gerrit/75488
|
|
|
12a457 |
Reviewed-by: Aravinda Vishwanathapura Krishna Murthy <avishwan@redhat.com>
|
|
|
12a457 |
---
|
|
|
12a457 |
geo-replication/syncdaemon/configinterface.py.in | 34 ++++++++++++++++++++--
|
|
|
12a457 |
1 files changed, 31 insertions(+), 3 deletions(-)
|
|
|
12a457 |
|
|
|
12a457 |
diff --git a/geo-replication/syncdaemon/configinterface.py.in b/geo-replication/syncdaemon/configinterface.py.in
|
|
|
12a457 |
index 0570061..5d67b8a 100644
|
|
|
12a457 |
--- a/geo-replication/syncdaemon/configinterface.py.in
|
|
|
12a457 |
+++ b/geo-replication/syncdaemon/configinterface.py.in
|
|
|
12a457 |
@@ -108,6 +108,35 @@ def upgrade_config_file(path):
|
|
|
12a457 |
config_change = True
|
|
|
12a457 |
config.set(sec, opt, newval)
|
|
|
12a457 |
|
|
|
12a457 |
+ # To convert from old peers section format to new peers section format.
|
|
|
12a457 |
+ # Old format: peers gluster://<master ip>:<master vol> \
|
|
|
12a457 |
+ # ssh://root@<slave ip>:gluster://<master ip>:<slave vol>
|
|
|
12a457 |
+ # New format: peers <master vol name> <slave vol name>
|
|
|
12a457 |
+ for old_sect in config.sections():
|
|
|
12a457 |
+ if old_sect.startswith("peers "):
|
|
|
12a457 |
+ peers_data = old_sect.split(" ")
|
|
|
12a457 |
+ mvol = peers_data[1].split("%3A")[-1]
|
|
|
12a457 |
+ svol = peers_data[2].split("%3A")[-1]
|
|
|
12a457 |
+ new_sect = "peers {0} {1}".format(mvol, svol)
|
|
|
12a457 |
+
|
|
|
12a457 |
+ if old_sect == new_sect:
|
|
|
12a457 |
+ # Already in new format "peers mastervol slavevol"
|
|
|
12a457 |
+ continue
|
|
|
12a457 |
+
|
|
|
12a457 |
+ # Create new section if not exists
|
|
|
12a457 |
+ try:
|
|
|
12a457 |
+ config.add_section(new_sect)
|
|
|
12a457 |
+ except ConfigParser.DuplicateSectionError:
|
|
|
12a457 |
+ pass
|
|
|
12a457 |
+
|
|
|
12a457 |
+ config_change = True
|
|
|
12a457 |
+ # Add all the items of old_sect to new_sect
|
|
|
12a457 |
+ for key, val in config.items(old_sect):
|
|
|
12a457 |
+ config.set(new_sect, key, val)
|
|
|
12a457 |
+
|
|
|
12a457 |
+ # Delete old section
|
|
|
12a457 |
+ config.remove_section(old_sect)
|
|
|
12a457 |
+
|
|
|
12a457 |
if config_change:
|
|
|
12a457 |
tempConfigFile = tempfile.NamedTemporaryFile(mode="wb", delete=False)
|
|
|
12a457 |
with open(tempConfigFile.name, 'wb') as configFile:
|
|
|
12a457 |
@@ -215,10 +244,9 @@ class GConffile(object):
|
|
|
12a457 |
peers = ['.', '.']
|
|
|
12a457 |
rx = True
|
|
|
12a457 |
if rx:
|
|
|
12a457 |
- st = 'peersrx'
|
|
|
12a457 |
+ return ' '.join(['peersrx'] + [escape(u) for u in peers])
|
|
|
12a457 |
else:
|
|
|
12a457 |
- st = 'peers'
|
|
|
12a457 |
- return ' '.join([st] + [escape(u) for u in peers])
|
|
|
12a457 |
+ return ' '.join(['peers'] + [u.split(':')[-1] for u in peers])
|
|
|
12a457 |
|
|
|
12a457 |
@staticmethod
|
|
|
12a457 |
def parse_section(section):
|
|
|
12a457 |
--
|
|
|
12a457 |
1.7.1
|
|
|
12a457 |
|