From c7cc5252a350ff78b5f8396d05c85b9d2ade17b8 Mon Sep 17 00:00:00 2001 From: Venky Shankar Date: Fri, 2 Aug 2013 15:34:00 +0530 Subject: glusterd: Saving geo-rep session details in a more specific path Now saving the session details in /var/lib/glusterd/geo-replication/__ repo to distinguish between two master-slave sessions where the slavename is same across two different clusters. Change-Id: I57c93f55cc9bd4fe2bffe579028aaf5e4335b223 BUG: 991501 Signed-off-by: Avra Sengupta Signed-off-by: Venky Shankar Reviewed-on: http://review.gluster.org/5488 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- geo-replication/syncdaemon/gsyncd.py | 2 ++ geo-replication/syncdaemon/monitor.py | 2 +- geo-replication/syncdaemon/resource.py | 9 +++++---- 3 files changed, 8 insertions(+), 5 deletions(-) (limited to 'geo-replication') diff --git a/geo-replication/syncdaemon/gsyncd.py b/geo-replication/syncdaemon/gsyncd.py index 67ba0737..b460c6c6 100644 --- a/geo-replication/syncdaemon/gsyncd.py +++ b/geo-replication/syncdaemon/gsyncd.py @@ -347,6 +347,8 @@ def main_i(): for j in range(3): namedict[mods[j](name)] = pa[j][i] namedict[name + 'vol'] = x.volume + if name == 'remote': + namedict['remotehost'] = x.remotehost if not 'config_file' in rconf: rconf['config_file'] = os.path.join(os.path.dirname(sys.argv[0]), "conf/gsyncd_template.conf") gcnf = GConffile(rconf['config_file'], canon_peers, defaults.__dict__, opts.__dict__, namedict) diff --git a/geo-replication/syncdaemon/monitor.py b/geo-replication/syncdaemon/monitor.py index badd0d9c..23655257 100644 --- a/geo-replication/syncdaemon/monitor.py +++ b/geo-replication/syncdaemon/monitor.py @@ -240,7 +240,7 @@ def distribute(*resources): else: slavenodes = set(b['host'] for b in sbricks) if isinstance(slave, SSH) and not gconf.isolated_slave: - rap = SSH.parse_ssh_address(slave.remote_addr) + rap = SSH.parse_ssh_address(slave) slaves = [ 'ssh://' + rap['user'] + '@' + h + ':' + si.url for h in slavenodes ] else: slavevols = [ h + ':' + si.volume for h in slavenodes ] diff --git a/geo-replication/syncdaemon/resource.py b/geo-replication/syncdaemon/resource.py index 401bca7f..297cdabc 100644 --- a/geo-replication/syncdaemon/resource.py +++ b/geo-replication/syncdaemon/resource.py @@ -1059,16 +1059,17 @@ class SSH(AbstractUrl, SlaveRemote): self.volume = inner_url[1:] @staticmethod - def parse_ssh_address(addr): - m = re.match('([^@]+)@(.+)', addr) + def parse_ssh_address(self): + m = re.match('([^@]+)@(.+)', self.remote_addr) if m: u, h = m.groups() else: - u, h = syncdutils.getusername(), addr + u, h = syncdutils.getusername(), self.remote_addr + self.remotehost = h return {'user': u, 'host': h} def canonical_path(self): - rap = self.parse_ssh_address(self.remote_addr) + rap = self.parse_ssh_address(self) remote_addr = '@'.join([rap['user'], gethostbyname(rap['host'])]) return ':'.join([remote_addr, self.inner_rsc.get_url(canonical=True)]) -- cgit