From 90b54c268b28f0bca9ea8a2056d9853121b247ab Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Wed, 10 Jun 2009 14:55:04 +0200 Subject: [PATCH] Convert call_version rpc to new style result This also cleans up its single use in cmdlib.py. Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Guido Trotter <ultrotter@google.com> --- daemons/ganeti-noded | 2 +- lib/cmdlib.py | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/daemons/ganeti-noded b/daemons/ganeti-noded index 67081e84f..d70fe8e7d 100755 --- a/daemons/ganeti-noded +++ b/daemons/ganeti-noded @@ -574,7 +574,7 @@ class NodeHttpServer(http.server.HttpServer): """Query version information. """ - return constants.PROTOCOL_VERSION + return True, constants.PROTOCOL_VERSION @staticmethod def perspective_upload_file(params): diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 916886e00..7c540b8d8 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -2287,17 +2287,17 @@ class LUAddNode(LogicalUnit): # check connectivity result = self.rpc.call_version([node])[node] - result.Raise() - if result.data: - if constants.PROTOCOL_VERSION == result.data: - logging.info("Communication to node %s fine, sw version %s match", - node, result.data) - else: - raise errors.OpExecError("Version mismatch master version %s," - " node version %s" % - (constants.PROTOCOL_VERSION, result.data)) + msg = result.RemoteFailMsg() + if msg: + raise errors.OpExecError("Can't get version information from" + " node %s: %s" % (node, msg)) + if constants.PROTOCOL_VERSION == result.payload: + logging.info("Communication to node %s fine, sw version %s match", + node, result.payload) else: - raise errors.OpExecError("Cannot get version from the new node") + raise errors.OpExecError("Version mismatch master version %s," + " node version %s" % + (constants.PROTOCOL_VERSION, result.payload)) # setup ssh on node logging.info("Copy ssh key to node %s", node) -- GitLab