[libvirt] [PATCH v4 3/3] virnuma: use virNumaNodesetIsAvailable checking nodeset in virNumaSetupMemoryPolicy

Chen Fan chen.fan.fnst at cn.fujitsu.com
Thu Oct 30 05:44:19 UTC 2014


Signed-off-by: Chen Fan <chen.fan.fnst at cn.fujitsu.com>
---
 src/util/virnuma.c | 23 ++++-------------------
 1 file changed, 4 insertions(+), 19 deletions(-)

diff --git a/src/util/virnuma.c b/src/util/virnuma.c
index 4188ef5..613a43c 100644
--- a/src/util/virnuma.c
+++ b/src/util/virnuma.c
@@ -95,31 +95,19 @@ virNumaSetupMemoryPolicy(virDomainNumatunePtr numatune,
     int ret = -1;
     int bit = 0;
     size_t i;
-    int maxnode = 0;
     virBitmapPtr tmp_nodemask = NULL;
 
+    if (!virNumaNodesetIsAvailable(numatune))
+        return -1;
+
     tmp_nodemask = virDomainNumatuneGetNodeset(numatune, nodemask, -1);
     if (!tmp_nodemask)
         return 0;
 
-    if (numa_available() < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       "%s", _("Host kernel is not aware of NUMA."));
-        return -1;
-    }
-
-    maxnode = numa_max_node();
-    maxnode = maxnode < NUMA_NUM_NODES ? maxnode : NUMA_NUM_NODES;
-
     /* Convert nodemask to NUMA bitmask. */
     nodemask_zero(&mask);
     bit = -1;
     while ((bit = virBitmapNextSetBit(tmp_nodemask, bit)) >= 0) {
-        if (bit > maxnode) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("NUMA node %d is out of range"), bit);
-            return -1;
-        }
         nodemask_set(&mask, bit);
     }
 
@@ -347,10 +335,7 @@ int
 virNumaSetupMemoryPolicy(virDomainNumatunePtr numatune,
                          virBitmapPtr nodemask ATTRIBUTE_UNUSED)
 {
-    if (virDomainNumatuneGetNodeset(numatune, NULL, -1)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("libvirt is compiled without NUMA tuning support"));
-
+    if (!virNumaNodesetIsAvailable(numatune)) {
         return -1;
     }
 
-- 
1.9.3




More information about the libvir-list mailing list