summaryrefslogtreecommitdiffstats
path: root/geo-replication
diff options
context:
space:
mode:
authorSaravanakumar Arumugam <sarumuga@redhat.com>2016-05-30 17:34:24 +0530
committerAravinda VK <avishwan@redhat.com>2016-05-31 03:19:12 -0700
commitd6442d8f4ac6d892cf5adc55ea5c34dcb01e1f26 (patch)
treebaf1d34d8e6e76441d06b7ad1988fdbfb29ecf33 /geo-replication
parentc3fdf4d973da6ffead7b316e7629f62a6139eb30 (diff)
geo-rep: update peers section in gsyncd conf
Problem: Once Slave volume uuid is involved as part of a geo-rep session, it is possible to create the same geo-rep session with different (slave)host. But, it reflects default values for geo-rep configuration values originally configured for old geo-rep session. Reason is, slave host is used while saving config options in gsyncd.conf. With new slave host, it is not possible to retrieve those config values. Solution: Remove slave host related information from gsyncd.conf and have only master volume and slave volume as part of peers section. Also, during upgrade from old geo-rep session, update peers section to reflect only master volume and slave volume. Change-Id: I7debf35a09a28d030b706b0c3e5d82c9b0467d0e BUG: 1340853 Signed-off-by: Saravanakumar Arumugam <sarumuga@redhat.com> Reviewed-on: http://review.gluster.org/14558 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kotresh HR <khiremat@redhat.com> Reviewed-by: Aravinda VK <avishwan@redhat.com>
Diffstat (limited to 'geo-replication')
-rw-r--r--geo-replication/syncdaemon/configinterface.py.in34
1 files changed, 31 insertions, 3 deletions
diff --git a/geo-replication/syncdaemon/configinterface.py.in b/geo-replication/syncdaemon/configinterface.py.in
index 0570061955f..5d67b8a471a 100644
--- a/geo-replication/syncdaemon/configinterface.py.in
+++ b/geo-replication/syncdaemon/configinterface.py.in
@@ -108,6 +108,35 @@ def upgrade_config_file(path):
config_change = True
config.set(sec, opt, newval)
+ # To convert from old peers section format to new peers section format.
+ # Old format: peers gluster://<master ip>:<master vol> \
+ # ssh://root@<slave ip>:gluster://<master ip>:<slave vol>
+ # New format: peers <master vol name> <slave vol name>
+ for old_sect in config.sections():
+ if old_sect.startswith("peers "):
+ peers_data = old_sect.split(" ")
+ mvol = peers_data[1].split("%3A")[-1]
+ svol = peers_data[2].split("%3A")[-1]
+ new_sect = "peers {0} {1}".format(mvol, svol)
+
+ if old_sect == new_sect:
+ # Already in new format "peers mastervol slavevol"
+ continue
+
+ # Create new section if not exists
+ try:
+ config.add_section(new_sect)
+ except ConfigParser.DuplicateSectionError:
+ pass
+
+ config_change = True
+ # Add all the items of old_sect to new_sect
+ for key, val in config.items(old_sect):
+ config.set(new_sect, key, val)
+
+ # Delete old section
+ config.remove_section(old_sect)
+
if config_change:
tempConfigFile = tempfile.NamedTemporaryFile(mode="wb", delete=False)
with open(tempConfigFile.name, 'wb') as configFile:
@@ -215,10 +244,9 @@ class GConffile(object):
peers = ['.', '.']
rx = True
if rx:
- st = 'peersrx'
+ return ' '.join(['peersrx'] + [escape(u) for u in peers])
else:
- st = 'peers'
- return ' '.join([st] + [escape(u) for u in peers])
+ return ' '.join(['peers'] + [u.split(':')[-1] for u in peers])
@staticmethod
def parse_section(section):