From c2fc8250a98d4e790ec9c21ea10e7a34c5241c13 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Wed, 10 Jun 2009 10:44:51 +0200
Subject: [PATCH] Convert node_has_ip_address rpc to new style

This should actually have a function in backend, but it's fine for now.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
---
 daemons/ganeti-noded | 2 +-
 lib/cmdlib.py        | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/daemons/ganeti-noded b/daemons/ganeti-noded
index 6ec61dc59..d9b1a44cb 100755
--- a/daemons/ganeti-noded
+++ b/daemons/ganeti-noded
@@ -493,7 +493,7 @@ class NodeHttpServer(http.server.HttpServer):
     """Checks if a node has the given ip address.
 
     """
-    return utils.OwnIpAddress(params[0])
+    return True, utils.OwnIpAddress(params[0])
 
   @staticmethod
   def perspective_node_info(params):
diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index 1ca4528c1..2d51ad255 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -2318,7 +2318,11 @@ class LUAddNode(LogicalUnit):
     if new_node.secondary_ip != new_node.primary_ip:
       result = self.rpc.call_node_has_ip_address(new_node.name,
                                                  new_node.secondary_ip)
-      if result.failed or not result.data:
+      msg = result.RemoteFailMsg()
+      if msg:
+        raise errors.OpPrereqError("Failure checking secondary ip"
+                                   " on node %s: %s" % (new_node.name, msg))
+      if not result.payload:
         raise errors.OpExecError("Node claims it doesn't have the secondary ip"
                                  " you gave (%s). Please fix and re-run this"
                                  " command." % new_node.secondary_ip)
-- 
GitLab