[PATCH] qemuxml2argvtest: uncoditionally mock NUMA routines

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

 



Currently, qemuxml2argvmock.c only mocks virNumaNodeIsAvailable(), and
only if libvirt was built with NUMA support. This causes some test
failures where NUMA is involved.

For example, memory-hotplug-dimm fails because it goes all they way down
to qemuBuildMemoryBackendStr() that calls virNumaNodesetIsAvailable()
for a user specified nodeset and fails, hence the test (unexpectedly)
fails.

To make qemuxml2argtest successfully run on non-NUMA platforms, do the
following:

 - mock virNumaNodeIsAvailable() unconditionally
 - add a mock for virNumaNodesetIsAvailable()
---
 tests/qemuxml2argvmock.c | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/tests/qemuxml2argvmock.c b/tests/qemuxml2argvmock.c
index 1616eed..57e56ab 100644
--- a/tests/qemuxml2argvmock.c
+++ b/tests/qemuxml2argvmock.c
@@ -56,17 +56,28 @@ virNumaGetMaxNode(void)
    return maxnodesNum;
 }
 
-#if WITH_NUMACTL && HAVE_NUMA_BITMASK_ISBITSET
-/*
- * In case libvirt is compiled with full NUMA support, we need to mock
- * this function in order to fake what numa nodes are available.
- */
 bool
 virNumaNodeIsAvailable(int node)
 {
     return node >= 0 && node <= virNumaGetMaxNode();
 }
-#endif /* WITH_NUMACTL && HAVE_NUMA_BITMASK_ISBITSET */
+
+bool
+virNumaNodesetIsAvailable(virBitmapPtr nodeset ATTRIBUTE_UNUSED)
+{
+    ssize_t bit = -1;
+
+    if (!nodeset)
+        return true;
+
+    while ((bit = virBitmapNextSetBit(nodeset, bit)) >= 0) {
+        if (virNumaNodeIsAvailable(bit))
+            continue;
+
+        return false;
+    }
+    return true;
+}
 
 char *
 virTPMCreateCancelPath(const char *devpath)
-- 
2.7.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[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]