From 38ea42a1ede4680bced2bb26bb2e9cc6c6fe59c2 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Wed, 10 Jun 2009 18:56:37 +0200
Subject: [PATCH] Convert test_delay rpc to new style result

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

diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index a96087ec8..50544fb30 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -6841,13 +6841,11 @@ class LUTestDelay(NoHooksLU):
         raise errors.OpExecError("Error during master delay test")
     if self.op.on_nodes:
       result = self.rpc.call_test_delay(self.op.on_nodes, self.op.duration)
-      if not result:
-        raise errors.OpExecError("Complete failure from rpc call")
       for node, node_result in result.items():
-        node_result.Raise()
-        if not node_result.data:
-          raise errors.OpExecError("Failure during rpc call to node %s,"
-                                   " result: %s" % (node, node_result.data))
+        msg = node_result.RemoteFailMsg()
+        if msg:
+          raise errors.OpExecError("Failure during rpc call to node %s: %s"
+                                   % (node, msg))
 
 
 class IAllocator(object):
diff --git a/lib/utils.py b/lib/utils.py
index 49f4c99d6..89436d8bb 100644
--- a/lib/utils.py
+++ b/lib/utils.py
@@ -1387,9 +1387,9 @@ def TestDelay(duration):
 
   """
   if duration < 0:
-    return False
+    return False, "Invalid sleep duration"
   time.sleep(duration)
-  return True
+  return True, None
 
 
 def _CloseFDNoErr(fd, retries=5):
-- 
GitLab