summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSaravanakumar Arumugam <sarumuga@redhat.com>2016-05-30 17:34:24 +0530
committerAravinda VK <avishwan@redhat.com>2016-06-01 09:32:55 -0700
commit4d73205fee5bf99527c78ef6838b14e3a2fdd4e3 (patch)
tree9852d1cf58ada806fae3c38fffbb59fa9046dc75
parent0e3b6f39924d8d1ef3b5fa57b5d38886b5d3626e (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: 1341121 Reviewed-on: http://review.gluster.org/#/c/14558/ Signed-off-by: Saravanakumar Arumugam <sarumuga@redhat.com> Reviewed-on: http://review.gluster.org/14566 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: Aravinda VK <avishwan@redhat.com>
-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):