]> xenbits.xensource.com Git - libvirt.git/commitdiff
Make nodeGetInfo report the correct number of NUMA nodes.
authorChris Lalancette <clalance@redhat.com>
Thu, 11 Mar 2010 20:45:11 +0000 (15:45 -0500)
committerChris Lalancette <clalance@redhat.com>
Fri, 12 Mar 2010 13:38:34 +0000 (08:38 -0500)
The nodeGetInfo code was always assuming that machine had a
single NUMA node, which is not correct.  The good news is that
libnuma gives us this information pretty easily, so let's
properly report it.

NOTE: With recent hardware starting to support CPU hot-add
and hot-remove, both this code and the nodeCapsInitNUMA()
code are quickly going to become obsolete.  We'll have to
think of a more dynamic solution for dealing with NUMA
nodes and CPUs that can come and go at will.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
src/nodeinfo.c

index 0748602f7419dcecbe2467b2a9c94fe356ffcdfa..8d7e0551c7596ff3f0b7cc9a947a2c2d8231d3a5 100644 (file)
@@ -159,7 +159,11 @@ int linuxNodeInfoCPUPopulate(virConnectPtr conn, FILE *cpuinfo,
 
     nodeinfo->cpus = 0;
     nodeinfo->mhz = 0;
-    nodeinfo->nodes = nodeinfo->cores = 1;
+    nodeinfo->cores = 1;
+    if (numa_available() < 0)
+        nodeinfo->nodes = 1;
+    else
+        nodeinfo->nodes = numa_max_node() + 1;
 
     /* NB: It is impossible to fill our nodes, since cpuinfo
      * has no knowledge of NUMA nodes */