NodeQuery: don't query non-vm_capable nodes
authorIustin Pop <iustin@google.com>
Thu, 17 Feb 2011 13:41:29 +0000 (14:41 +0100)
committerIustin Pop <iustin@google.com>
Thu, 17 Feb 2011 17:25:00 +0000 (18:25 +0100)
Because non-vm_capable nodes most likely don't have a hypervisor
configured and/or storage, so the call will fail anyway.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>

lib/cmdlib.py

index 072cc88..4fc29c1 100644 (file)
@@ -3630,7 +3630,10 @@ class _NodeQuery(_QueryBase):
 
     # Gather data as requested
     if query.NQ_LIVE in self.requested_data:
-      node_data = lu.rpc.call_node_info(nodenames, lu.cfg.GetVGName(),
+      # filter out non-vm_capable nodes
+      toquery_nodes = [name for name in nodenames if all_info[name].vm_capable]
+
+      node_data = lu.rpc.call_node_info(toquery_nodes, lu.cfg.GetVGName(),
                                         lu.cfg.GetHypervisorType())
       live_data = dict((name, nresult.payload)
                        for (name, nresult) in node_data.items()