Revision 3ddd94f9 lib/cmdlib.py

b/lib/cmdlib.py
677 677
    assert not lu.glm.is_owned(level), "No locks should be owned"
678 678

  
679 679

  
680
def _MapInstanceDisksToNodes(instances):
681
  """Creates a map from (node, volume) to instance name.
682

  
683
  @type instances: list of L{objects.Instance}
684
  @rtype: dict; tuple of (node name, volume name) as key, instance name as value
685

  
686
  """
687
  return dict(((node, vol), inst.name)
688
              for inst in instances
689
              for (node, vols) in inst.MapLVsByNode().items()
690
              for vol in vols)
691

  
692

  
680 693
def _RunPostHook(lu, node_name):
681 694
  """Runs the post-hook for an opcode on a single node.
682 695

  
......
4254 4267
    volumes = self.rpc.call_node_volumes(nodenames)
4255 4268

  
4256 4269
    ilist = self.cfg.GetAllInstancesInfo()
4257

  
4258
    vol2inst = dict(((node, vol), inst.name)
4259
                    for inst in ilist.values()
4260
                    for (node, vols) in inst.MapLVsByNode().items()
4261
                    for vol in vols)
4270
    vol2inst = _MapInstanceDisksToNodes(ilist.values())
4262 4271

  
4263 4272
    output = []
4264 4273
    for node in nodenames:

Also available in: Unified diff