Revision 0105bad3

b/lib/cmdlib.py
1759 1759
    "dtotal", "dfree",
1760 1760
    "mtotal", "mnode", "mfree",
1761 1761
    "bootid",
1762
    "ctotal",
1762
    "ctotal", "cnodes", "csockets",
1763 1763
    )
1764 1764

  
1765 1765
  _FIELDS_STATIC = utils.FieldSet(
......
1838 1838
            "dfree": fn(int, nodeinfo.get('vg_free', None)),
1839 1839
            "ctotal": fn(int, nodeinfo.get('cpu_total', None)),
1840 1840
            "bootid": nodeinfo.get('bootid', None),
1841
            "cnodes": fn(int, nodeinfo.get('cpu_nodes', None)),
1842
            "csockets": fn(int, nodeinfo.get('cpu_sockets', None)),
1841 1843
            }
1842 1844
        else:
1843 1845
          live_data[name] = {}
b/lib/hypervisor/hv_fake.py
200 200
    except EnvironmentError, err:
201 201
      raise errors.HypervisorError("Failed to list node info: %s" % err)
202 202
    result['cpu_total'] = cpu_total
203
    # FIXME: export correct data here
204
    result['cpu_nodes'] = 1
205
    result['cpu_sockets'] = 1
203 206

  
204 207
    return result
205 208

  
b/lib/hypervisor/hv_kvm.py
639 639
    except EnvironmentError, err:
640 640
      raise errors.HypervisorError("Failed to list node info: %s" % err)
641 641
    result['cpu_total'] = cpu_total
642
    # FIXME: export correct data here
643
    result['cpu_nodes'] = 1
644
    result['cpu_sockets'] = 1
642 645

  
643 646
    return result
644 647

  
......
779 782
    if iso_path and not os.path.isfile(iso_path):
780 783
      raise errors.HypervisorError("Instance cdrom image '%s' not found or"
781 784
                                   " not a file" % iso_path)
782

  
783

  
b/lib/hypervisor/hv_xen.py
199 199
  def GetNodeInfo(self):
200 200
    """Return information about the node.
201 201

  
202
    @return: a dict with the following keys (values in MiB):
202
    @return: a dict with the following keys (memory values in MiB):
203 203
          - memory_total: the total memory size on the node
204 204
          - memory_free: the available memory on the node for instances
205 205
          - memory_dom0: the memory used by the node itself, if available
206
          - nr_cpus: total number of CPUs
207
          - nr_nodes: in a NUMA system, the number of domains
208
          - nr_sockets: the number of physical CPU sockets in the node
206 209

  
207 210
    """
208 211
    # note: in xen 3, memory has changed to total_memory
......
214 217

  
215 218
    xmoutput = result.stdout.splitlines()
216 219
    result = {}
220
    cores_per_socket = threads_per_core = nr_cpus = None
217 221
    for line in xmoutput:
218 222
      splitfields = line.split(":", 1)
219 223

  
......
225 229
        elif key == 'free_memory':
226 230
          result['memory_free'] = int(val)
227 231
        elif key == 'nr_cpus':
228
          result['cpu_total'] = int(val)
232
          nr_cpus = result['cpu_total'] = int(val)
233
        elif key == 'nr_nodes':
234
          result['cpu_nodes'] = int(val)
235
        elif key == 'cores_per_socket':
236
          cores_per_socket = int(val)
237
        elif key == 'threads_per_core':
238
          threads_per_core = int(val)
239

  
240
    if (cores_per_socket is not None and
241
        threads_per_core is not None and nr_cpus is not None):
242
      result['cpu_sockets'] = nr_cpus / (cores_per_socket * threads_per_core)
243

  
229 244
    dom0_info = self.GetInstanceInfo("Domain-0")
230 245
    if dom0_info is not None:
231 246
      result['memory_dom0'] = dom0_info[2]
b/lib/rapi/rlib2.py
42 42
N_FIELDS = ["name", "offline", "master_candidate",
43 43
            "dtotal", "dfree",
44 44
            "mtotal", "mnode", "mfree",
45
            "pinst_cnt", "sinst_cnt", "tags"]
45
            "pinst_cnt", "sinst_cnt", "tags",
46
            "ctotal", "cnodes", "csockets",
47
            ]
46 48

  
47 49

  
48 50
class R_version(baserlib.R_Generic):
b/scripts/gnt-node
50 50
  "dtotal": "DTotal", "dfree": "DFree",
51 51
  "mtotal": "MTotal", "mnode": "MNode", "mfree": "MFree",
52 52
  "bootid": "BootID",
53
  "ctotal": "CTotal",
53
  "ctotal": "CTotal", "cnodes": "CNodes", "csockets": "CSockets",
54 54
  "tags": "Tags",
55 55
  "serial_no": "SerialNo",
56 56
  "master_candidate": "MasterC",

Also available in: Unified diff