rpc / noded: add hvparams to instance_list call
authorHelga Velroyen <helgav@google.com>
Fri, 24 May 2013 15:56:17 +0000 (17:56 +0200)
committerHelga Velroyen <helgav@google.com>
Wed, 12 Jun 2013 07:17:32 +0000 (09:17 +0200)
The 'instance_list' call needs to be extended to accept
hvparams. This is one of the few RPCs where it is
necessary, because there is no instance given whose
hvparams could be reused.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Thomas Thrainer <thomasth@google.com>

lib/cmdlib/common.py
lib/cmdlib/instance_migration.py
lib/cmdlib/instance_operation.py
lib/rpc_defs.py
lib/server/noded.py

index 571a69f..6fb9faa 100644 (file)
@@ -962,7 +962,9 @@ def CheckInstanceState(lu, instance, req_states, msg=None):
   if constants.ADMINST_UP not in req_states:
     pnode = instance.primary_node
     if not lu.cfg.GetNodeInfo(pnode).offline:
-      ins_l = lu.rpc.call_instance_list([pnode], [instance.hypervisor])[pnode]
+      all_hvparams = lu.cfg.GetClusterInfo().hvparams
+      ins_l = lu.rpc.call_instance_list([pnode], [instance.hypervisor],
+                                        all_hvparams)[pnode]
       ins_l.Raise("Can't contact node %s for instance information" % pnode,
                   prereq=True, ecode=errors.ECODE_ENVIRON)
       if instance.name in ins_l.payload:
index 9b715ae..b50ad9c 100644 (file)
@@ -545,7 +545,9 @@ class TLMigrateInstance(Tasklet):
     self.feedback_fn("* checking where the instance actually runs"
                      " (if this hangs, the hypervisor might be in"
                      " a bad state)")
-    ins_l = self.rpc.call_instance_list(self.all_nodes, [instance.hypervisor])
+    cluster_hvparams = self.cfg.GetClusterInfo().hvparams
+    ins_l = self.rpc.call_instance_list(self.all_nodes, [instance.hypervisor],
+                                        cluster_hvparams)
     for node, result in ins_l.items():
       result.Raise("Can't contact node %s" % node)
 
index 7137c15..de82631 100644 (file)
@@ -483,8 +483,10 @@ class LUInstanceConsole(NoHooksLU):
     instance = self.instance
     node = instance.primary_node
 
+    cluster_hvparams = self.cfg.GetClusterInfo().hvparams
     node_insts = self.rpc.call_instance_list([node],
-                                             [instance.hypervisor])[node]
+                                             [instance.hypervisor],
+                                             cluster_hvparams)[node]
     node_insts.Raise("Can't get node information from %s" % node)
 
     if instance.name not in node_insts.payload:
index 1ebf35d..c8f59f1 100644 (file)
@@ -225,6 +225,7 @@ _INSTANCE_CALLS = [
    "Returns information about all instances on the given nodes"),
   ("instance_list", MULTI, None, constants.RPC_TMO_URGENT, [
     ("hypervisor_list", None, "Hypervisors to query for instances"),
+    ("hvparams", None, "Hvparams of all hypervisors"),
     ], None, None, "Returns the list of running instances on the given nodes"),
   ("instance_reboot", SINGLE, None, constants.RPC_TMO_NORMAL, [
     ("inst", ED_INST_DICT, "Instance object"),
index aedd321..40ec1ec 100644 (file)
@@ -704,7 +704,8 @@ class NodeRequestHandler(http.server.HttpServerHandler):
     """Query the list of running instances.
 
     """
-    return backend.GetInstanceList(params[0])
+    (hypervisor_list, hvparams) = params
+    return backend.GetInstanceList(hypervisor_list, hvparams)
 
   # node --------------------------