"dtotal", "dfree",
"mtotal", "mnode", "mfree",
"bootid",
- "ctotal",
+ "ctotal", "cnodes", "csockets",
)
_FIELDS_STATIC = utils.FieldSet(
"dfree": fn(int, nodeinfo.get('vg_free', None)),
"ctotal": fn(int, nodeinfo.get('cpu_total', None)),
"bootid": nodeinfo.get('bootid', None),
+ "cnodes": fn(int, nodeinfo.get('cpu_nodes', None)),
+ "csockets": fn(int, nodeinfo.get('cpu_sockets', None)),
}
else:
live_data[name] = {}
except EnvironmentError, err:
raise errors.HypervisorError("Failed to list node info: %s" % err)
result['cpu_total'] = cpu_total
+ # FIXME: export correct data here
+ result['cpu_nodes'] = 1
+ result['cpu_sockets'] = 1
return result
except EnvironmentError, err:
raise errors.HypervisorError("Failed to list node info: %s" % err)
result['cpu_total'] = cpu_total
+ # FIXME: export correct data here
+ result['cpu_nodes'] = 1
+ result['cpu_sockets'] = 1
return result
if iso_path and not os.path.isfile(iso_path):
raise errors.HypervisorError("Instance cdrom image '%s' not found or"
" not a file" % iso_path)
-
-
def GetNodeInfo(self):
"""Return information about the node.
- @return: a dict with the following keys (values in MiB):
+ @return: a dict with the following keys (memory values in MiB):
- memory_total: the total memory size on the node
- memory_free: the available memory on the node for instances
- memory_dom0: the memory used by the node itself, if available
+ - nr_cpus: total number of CPUs
+ - nr_nodes: in a NUMA system, the number of domains
+ - nr_sockets: the number of physical CPU sockets in the node
"""
# note: in xen 3, memory has changed to total_memory
xmoutput = result.stdout.splitlines()
result = {}
+ cores_per_socket = threads_per_core = nr_cpus = None
for line in xmoutput:
splitfields = line.split(":", 1)
elif key == 'free_memory':
result['memory_free'] = int(val)
elif key == 'nr_cpus':
- result['cpu_total'] = int(val)
+ nr_cpus = result['cpu_total'] = int(val)
+ elif key == 'nr_nodes':
+ result['cpu_nodes'] = int(val)
+ elif key == 'cores_per_socket':
+ cores_per_socket = int(val)
+ elif key == 'threads_per_core':
+ threads_per_core = int(val)
+
+ if (cores_per_socket is not None and
+ threads_per_core is not None and nr_cpus is not None):
+ result['cpu_sockets'] = nr_cpus / (cores_per_socket * threads_per_core)
+
dom0_info = self.GetInstanceInfo("Domain-0")
if dom0_info is not None:
result['memory_dom0'] = dom0_info[2]
N_FIELDS = ["name", "offline", "master_candidate",
"dtotal", "dfree",
"mtotal", "mnode", "mfree",
- "pinst_cnt", "sinst_cnt", "tags"]
+ "pinst_cnt", "sinst_cnt", "tags",
+ "ctotal", "cnodes", "csockets",
+ ]
class R_version(baserlib.R_Generic):
"dtotal": "DTotal", "dfree": "DFree",
"mtotal": "MTotal", "mnode": "MNode", "mfree": "MFree",
"bootid": "BootID",
- "ctotal": "CTotal",
+ "ctotal": "CTotal", "cnodes": "CNodes", "csockets": "CSockets",
"tags": "Tags",
"serial_no": "SerialNo",
"master_candidate": "MasterC",