Revision 843094ad lib/cmdlib/group.py

b/lib/cmdlib/group.py
37 37
  MergeAndVerifyDiskState, GetWantedNodes, GetUpdatedParams, \
38 38
  CheckNodeGroupInstances, GetUpdatedIPolicy, \
39 39
  ComputeNewInstanceViolations, GetDefaultIAllocator, ShareAll, \
40
  CheckInstancesNodeGroups, LoadNodeEvacResult, MapInstanceDisksToNodes
40
  CheckInstancesNodeGroups, LoadNodeEvacResult, MapInstanceLvsToNodes
41 41

  
42 42
import ganeti.masterd.instance
43 43

  
......
911 911
        missing volumes
912 912

  
913 913
    """
914
    res_nodes = {}
915
    res_instances = set()
916
    res_missing = {}
914
    node_errors = {}
915
    offline_lv_instance_names = set()
916
    missing_lvs = {}
917 917

  
918
    nv_dict = MapInstanceDisksToNodes(
918
    node_lv_to_inst = MapInstanceLvsToNodes(
919 919
      [inst for inst in self.instances.values() if inst.disks_active])
920 920

  
921
    if nv_dict:
921
    if node_lv_to_inst:
922 922
      node_uuids = utils.NiceSort(set(self.owned_locks(locking.LEVEL_NODE)) &
923 923
                                  set(self.cfg.GetVmCapableNodeList()))
924 924

  
......
932 932
        if msg:
933 933
          logging.warning("Error enumerating LVs on node %s: %s",
934 934
                          self.cfg.GetNodeName(node_uuid), msg)
935
          res_nodes[node_uuid] = msg
935
          node_errors[node_uuid] = msg
936 936
          continue
937 937

  
938 938
        for lv_name, (_, _, lv_online) in node_res.payload.items():
939
          inst = nv_dict.pop((node_uuid, lv_name), None)
940
          if not (lv_online or inst is None):
941
            res_instances.add(inst)
939
          inst = node_lv_to_inst.pop((node_uuid, lv_name), None)
940
          if not lv_online and inst is not None:
941
            offline_lv_instance_names.add(inst.name)
942 942

  
943 943
      # any leftover items in nv_dict are missing LVs, let's arrange the data
944 944
      # better
945
      for key, inst in nv_dict.iteritems():
946
        res_missing.setdefault(inst, []).append(list(key))
945
      for key, inst in node_lv_to_inst.iteritems():
946
        missing_lvs.setdefault(inst.name, []).append(list(key))
947 947

  
948
    return (res_nodes, list(res_instances), res_missing)
948
    return (node_errors, list(offline_lv_instance_names), missing_lvs)

Also available in: Unified diff