From 68959ca566ffa5eb3ed3ed7c76b629b79318a383 Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Tue, 25 Oct 2011 19:17:10 +0200
Subject: [PATCH] rpc: Convert call for HV parameter validation

Instead of filling the parameters in the RPC layer, that is now done
before the wrapper is called, thereby simplifying the wrapper.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
---
 lib/build/rpc_definitions.py |  4 ++++
 lib/cmdlib.py                |  8 +++++---
 lib/rpc.py                   | 19 -------------------
 3 files changed, 9 insertions(+), 22 deletions(-)

diff --git a/lib/build/rpc_definitions.py b/lib/build/rpc_definitions.py
index b30477c54..821d6bdb5 100644
--- a/lib/build/rpc_definitions.py
+++ b/lib/build/rpc_definitions.py
@@ -364,6 +364,10 @@ _MISC_CALLS = [
   ("test_delay", MULTI, None, [
     ("duration", None, None),
     ], None, "Sleep for a fixed time on given node(s)"),
+  ("hypervisor_validate_params", MULTI, TMO_NORMAL, [
+    ("hvname", None, "Hypervisor name"),
+    ("hvfull", None, "Parameters to be validated"),
+    ], None, "Validate hypervisor params"),
   ]
 
 CALLS = {
diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index f670f337b..c45b75c21 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -8223,9 +8223,11 @@ def _CheckHVParams(lu, nodenames, hvname, hvparams):
 
   """
   nodenames = _FilterVmNodes(lu, nodenames)
-  hvinfo = lu.rpc.call_hypervisor_validate_params(nodenames,
-                                                  hvname,
-                                                  hvparams)
+
+  cluster = lu.cfg.GetClusterInfo()
+  hvfull = objects.FillDict(cluster.hvparams.get(hvname, {}), hvparams)
+
+  hvinfo = lu.rpc.call_hypervisor_validate_params(nodenames, hvname, hvfull)
   for node in nodenames:
     info = hvinfo[node]
     if info.offline:
diff --git a/lib/rpc.py b/lib/rpc.py
index 0bd636b42..1ecff15c4 100644
--- a/lib/rpc.py
+++ b/lib/rpc.py
@@ -691,25 +691,6 @@ class RpcRunner(_generated_rpc.RpcClientDefault,
     return self.call_test_delay(node_list, duration,
                                 read_timeout=int(duration + 5))
 
-  @_RpcTimeout(_TMO_NORMAL)
-  def call_hypervisor_validate_params(self, node_list, hvname, hvparams):
-    """Validate the hypervisor params.
-
-    This is a multi-node call.
-
-    @type node_list: list
-    @param node_list: the list of nodes to query
-    @type hvname: string
-    @param hvname: the hypervisor name
-    @type hvparams: dict
-    @param hvparams: the hypervisor parameters to be validated
-
-    """
-    cluster = self._cfg.GetClusterInfo()
-    hv_full = objects.FillDict(cluster.hvparams.get(hvname, {}), hvparams)
-    return self._MultiNodeCall(node_list, "hypervisor_validate_params",
-                               [hvname, hv_full])
-
 
 class JobQueueRunner(_generated_rpc.RpcClientJobQueue):
   """RPC wrappers for job queue.
-- 
GitLab