Revision 4a72cc75 lib/cmdlib.py

b/lib/cmdlib.py
3308 3308
    return result
3309 3309

  
3310 3310

  
3311
class LUQueryNodeData(NoHooksLU):
3312
  """Logical unit for querying node data.
3313

  
3314
  """
3315
  _OP_REQP = ["nodes"]
3316

  
3317
  def CheckPrereq(self):
3318
    """Check prerequisites.
3319

  
3320
    This only checks the optional node list against the existing names.
3321

  
3322
    """
3323
    self.wanted_nodes = _GetWantedNodes(self, self.op.nodes)
3324

  
3325
  def Exec(self, feedback_fn):
3326
    """Compute and return the list of nodes.
3327

  
3328
    """
3329
    ilist = [self.cfg.GetInstanceInfo(iname) for iname
3330
             in self.cfg.GetInstanceList()]
3331
    result = []
3332
    for node in [self.cfg.GetNodeInfo(name) for name in self.wanted_nodes]:
3333
      result.append((node.name, node.primary_ip, node.secondary_ip,
3334
                     [inst.name for inst in ilist
3335
                      if inst.primary_node == node.name],
3336
                     [inst.name for inst in ilist
3337
                      if node.name in inst.secondary_nodes],
3338
                     ))
3339
    return result
3340

  
3341

  
3342 3311
class LUSetInstanceParms(LogicalUnit):
3343 3312
  """Modifies an instances's parameters.
3344 3313

  

Also available in: Unified diff