diff options
author | Csaba Henk <csaba@gluster.com> | 2011-02-07 01:32:55 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2011-02-07 00:59:10 -0800 |
commit | 4b96f79fa19191344ddeeafd40df8b6d18ef7cc9 (patch) | |
tree | 570c208dc7f377d8b5aa411521820e7ff5f9e86b /xlators/features | |
parent | 67f842aa406a05fd701f9dbdcd373516fa529087 (diff) |
syncdaemon: version the rpc
Signed-off-by: Csaba Henk <csaba@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 2381 (RePCe versioning)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2381
Diffstat (limited to 'xlators/features')
-rw-r--r-- | xlators/features/marker/utils/syncdaemon/repce.py | 9 | ||||
-rw-r--r-- | xlators/features/marker/utils/syncdaemon/resource.py | 12 |
2 files changed, 19 insertions, 2 deletions
diff --git a/xlators/features/marker/utils/syncdaemon/repce.py b/xlators/features/marker/utils/syncdaemon/repce.py index f878d481a6c..aebc8b7d80c 100644 --- a/xlators/features/marker/utils/syncdaemon/repce.py +++ b/xlators/features/marker/utils/syncdaemon/repce.py @@ -21,6 +21,7 @@ except ImportError: import pickle pickle_proto = -1 +repce_version = 1.0 def ioparse(i, o): if isinstance(i, int): @@ -148,3 +149,11 @@ class RepceClient(object): def __getattr__(self, meth): return self.mprx(self, meth) + + def __version__(self): + d = {'proto': repce_version} + try: + d['object'] = self('version') + except AttributeError: + pass + return d diff --git a/xlators/features/marker/utils/syncdaemon/resource.py b/xlators/features/marker/utils/syncdaemon/resource.py index 93199f51857..6529155a092 100644 --- a/xlators/features/marker/utils/syncdaemon/resource.py +++ b/xlators/features/marker/utils/syncdaemon/resource.py @@ -166,6 +166,10 @@ class Server(object): cls.lastping += 1 return cls.lastping + @staticmethod + def version(): + return 1.0 + class SlaveLocal(object): @@ -208,6 +212,10 @@ class SlaveRemote(object): def start_fd_client(self, i, o, **opts): self.server = RepceClient(i, o) + rv = self.server.__version__() + exrv = {'proto': repce.repce_version, 'object': Server.version()} + if rv != exrv: + raise RuntimeError("RePCe version mismatch: local %s, remote %s" % (exrv, rv)) if gconf.timeout and int(gconf.timeout) > 0: def pinger(): while True: @@ -350,7 +358,7 @@ class SSH(AbstractUrl, SlaveRemote): deferred = go_daemon == 'postconn' ret = sup(self, gconf.ssh_command.split() + gconf.ssh_ctl_args + [self.remote_addr], slave=self.inner_rsc.url, deferred=deferred) if deferred: - # send a ping to peer so that we can wait for + # send a message to peer so that we can wait for # the answer from which we know connection is # established and we can proceed with daemonization # (doing that too early robs the ssh passwd prompt...) @@ -359,7 +367,7 @@ class SSH(AbstractUrl, SlaveRemote): # in daemon), we just do a an ad-hoc linear put/get. i, o = ret inf = os.fdopen(i) - repce.send(o, None, 'ping') + repce.send(o, None, '__version__') select.select((inf,), (), ()) repce.recv(inf) # hack hack hack: store a global reference to the file |