Revision 434b96a2

b/lib/cmdlib.py
5860 5860
      nodes = None
5861 5861
      groups = None
5862 5862

  
5863
    if query.IQ_NETWORKS in self.requested_data:
5864
      net_uuids = itertools.chain(*(lu.cfg.GetInstanceNetworks(i.name)
5865
                                    for i in instance_list))
5866
      networks = dict((uuid, lu.cfg.GetNetwork(uuid)) for uuid in net_uuids)
5867
    else:
5868
      networks = None
5869

  
5863 5870
    return query.InstanceQueryData(instance_list, lu.cfg.GetClusterInfo(),
5864 5871
                                   disk_usage, offline_nodes, bad_nodes,
5865 5872
                                   live_data, wrongnode_inst, consinfo,
5866
                                   nodes, groups)
5873
                                   nodes, groups, networks)
5867 5874

  
5868 5875

  
5869 5876
class LUQuery(NoHooksLU):
......
16543 16550
    network_uuids = self._GetNames(lu, all_networks.keys(),
16544 16551
                                   locking.LEVEL_NETWORK)
16545 16552

  
16546
    name_to_uuid = dict((n.name, n.uuid) for n in all_networks.values())
16547

  
16548 16553
    do_instances = query.NETQ_INST in self.requested_data
16549 16554
    do_groups = query.NETQ_GROUP in self.requested_data
16550 16555

  
......
16569 16574
      network_to_instances = dict((uuid, []) for uuid in network_uuids)
16570 16575
      for instance in all_instances.values():
16571 16576
        for nic in instance.nics:
16572
          if nic.network:
16573
            net_uuid = name_to_uuid[nic.network]
16574
            if net_uuid in network_uuids:
16575
              network_to_instances[net_uuid].append(instance.name)
16577
          if nic.network in network_uuids:
16578
            network_to_instances[nic.network].append(instance.name)
16576 16579
            break
16577 16580

  
16578 16581
    if query.NETQ_STATS in self.requested_data:

Also available in: Unified diff