[PATCH 3/4] virnumamock: Allow CPU-less NUMA nodes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The original virNumaGetNodeCPUs() returns an empty virBitmap if
given NUMA node has no CPUs. But that's not how our mock behaves
- it looks under $fakesysfs/node/node$N/cpulist only to find an
empty file which is then passed to virBitmapParseUnlimited()
which threats such input as error.

Fortunately, we don't have any fake sysfs data where this path is
hit, but we might soon.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 tests/virnumamock.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tests/virnumamock.c b/tests/virnumamock.c
index 3a203ded77..ff9c6e951d 100644
--- a/tests/virnumamock.c
+++ b/tests/virnumamock.c
@@ -172,7 +172,12 @@ virNumaGetNodeCPUs(int node, virBitmap **cpus)
                                SYSFS_SYSTEM_PATH, node) < 0)
         return -1;
 
-    *cpus = virBitmapParseUnlimited(cpulist);
+    if (STREQ(cpulist, "")) {
+        unsigned int max_n_cpus = virNumaGetMaxCPUs();
+        *cpus = virBitmapNew(max_n_cpus);
+    } else {
+        *cpus = virBitmapParseUnlimited(cpulist);
+    }
     if (!*cpus)
         goto cleanup;
 
-- 
2.26.3




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux