Commit ff05ff94 authored by Bernardo Dal Seno's avatar Bernardo Dal Seno
Browse files

Hypervisors report CPUs used by the node OS

The XenHypervisor's "dom0_cpus" parameter (introduced in 1d60fec6

 but never
used) is renamed to "cpu_dom0" for consistency with other parameter
names. The analogous information is returned for the other hypervisors.
Signed-off-by: default avatarBernardo Dal Seno <bdalseno@google.com>
Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
parent ef14e128
......@@ -244,6 +244,7 @@ class BaseHypervisor(object):
- memory_free: the available memory on the node for instances
- memory_dom0: the memory used by the node itself, if available
- cpu_total: total number of CPUs
- cpu_dom0: number of CPUs used by the node OS
- cpu_nodes: number of NUMA domains
- cpu_sockets: number of physical CPU sockets
......@@ -479,6 +480,7 @@ class BaseHypervisor(object):
- memory_free: the available memory on the node for instances
- memory_dom0: the memory used by the node itself, if available
- cpu_total: total number of CPUs
- cpu_dom0: number of CPUs used by the node OS
- cpu_nodes: number of NUMA domains
- cpu_sockets: number of physical CPU sockets
......@@ -519,6 +521,8 @@ class BaseHypervisor(object):
except EnvironmentError, err:
raise errors.HypervisorError("Failed to list node info: %s" % (err,))
result["cpu_total"] = cpu_total
# We assume that the node OS can access all the CPUs
result["cpu_dom0"] = cpu_total
# FIXME: export correct data here
result["cpu_nodes"] = 1
result["cpu_sockets"] = 1
......
......@@ -241,7 +241,7 @@ def _MergeInstanceInfo(info, instance_list):
for (name, _, mem, vcpus, _, _) in instance_list:
if name == _DOM0_NAME:
info["memory_dom0"] = mem
info["dom0_cpus"] = vcpus
info["cpu_dom0"] = vcpus
# Include Dom0 in total memory usage
total_instmem += mem
......
......@@ -240,7 +240,7 @@ class TestMergeInstanceInfo(testutils.GanetiTestCase):
result = hv_xen._MergeInstanceInfo({}, instance_list)
self.assertEqual(result, {
"memory_dom0": 4096,
"dom0_cpus": 7,
"cpu_dom0": 7,
})
def testWithNodeInfo(self):
......@@ -251,7 +251,7 @@ class TestMergeInstanceInfo(testutils.GanetiTestCase):
"cpu_nodes": 1,
"cpu_sockets": 2,
"cpu_total": 4,
"dom0_cpus": 7,
"cpu_dom0": 7,
"hv_version": (4, 0),
"memory_dom0": 4096,
"memory_free": 8004,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment