Revision 73cdf9a3

b/lib/cmdlib.py
11865 11865
    """Compute node groups data.
11866 11866

  
11867 11867
    """
11868
    ng = {}
11869
    for guuid, gdata in cfg.GetAllNodeGroupsInfo().items():
11870
      ng[guuid] = {
11871
        "name": gdata.name,
11872
        "alloc_policy": gdata.alloc_policy,
11873
        }
11868
    ng = dict((guuid, {
11869
      "name": gdata.name,
11870
      "alloc_policy": gdata.alloc_policy,
11871
      })
11872
      for guuid, gdata in cfg.GetAllNodeGroupsInfo().items())
11873

  
11874 11874
    return ng
11875 11875

  
11876 11876
  @staticmethod
......
11881 11881
    @returns: a dict of name: (node dict, node config)
11882 11882

  
11883 11883
    """
11884
    node_results = {}
11885
    for ninfo in node_cfg.values():
11886
      # fill in static (config-based) values
11887
      pnr = {
11888
        "tags": list(ninfo.GetTags()),
11889
        "primary_ip": ninfo.primary_ip,
11890
        "secondary_ip": ninfo.secondary_ip,
11891
        "offline": ninfo.offline,
11892
        "drained": ninfo.drained,
11893
        "master_candidate": ninfo.master_candidate,
11894
        "group": ninfo.group,
11895
        "master_capable": ninfo.master_capable,
11896
        "vm_capable": ninfo.vm_capable,
11897
        }
11898

  
11899
      node_results[ninfo.name] = pnr
11884
    # fill in static (config-based) values
11885
    node_results = dict((ninfo.name, {
11886
      "tags": list(ninfo.GetTags()),
11887
      "primary_ip": ninfo.primary_ip,
11888
      "secondary_ip": ninfo.secondary_ip,
11889
      "offline": ninfo.offline,
11890
      "drained": ninfo.drained,
11891
      "master_candidate": ninfo.master_candidate,
11892
      "group": ninfo.group,
11893
      "master_capable": ninfo.master_capable,
11894
      "vm_capable": ninfo.vm_capable,
11895
      })
11896
      for ninfo in node_cfg.values())
11900 11897

  
11901 11898
    return node_results
11902 11899

  
......
11970 11967
      nic_data = []
11971 11968
      for nic in iinfo.nics:
11972 11969
        filled_params = cluster_info.SimpleFillNIC(nic.nicparams)
11973
        nic_dict = {"mac": nic.mac,
11974
                    "ip": nic.ip,
11975
                    "mode": filled_params[constants.NIC_MODE],
11976
                    "link": filled_params[constants.NIC_LINK],
11977
                   }
11970
        nic_dict = {
11971
          "mac": nic.mac,
11972
          "ip": nic.ip,
11973
          "mode": filled_params[constants.NIC_MODE],
11974
          "link": filled_params[constants.NIC_LINK],
11975
          }
11978 11976
        if filled_params[constants.NIC_MODE] == constants.NIC_MODE_BRIDGED:
11979 11977
          nic_dict["bridge"] = filled_params[constants.NIC_LINK]
11980 11978
        nic_data.append(nic_dict)
......
12014 12012
      self.required_nodes = 2
12015 12013
    else:
12016 12014
      self.required_nodes = 1
12015

  
12017 12016
    request = {
12018 12017
      "name": self.name,
12019 12018
      "disk_template": self.disk_template,
......
12026 12025
      "nics": self.nics,
12027 12026
      "required_nodes": self.required_nodes,
12028 12027
      }
12028

  
12029 12029
    return request
12030 12030

  
12031 12031
  def _AddRelocateInstance(self):

Also available in: Unified diff