[libvirt PATCH 2/3] test: fix emulator pin info in test driver

Pavel Hrdina phrdina at redhat.com
Fri Aug 7 14:59:13 UTC 2020


Commit <6328da04285d9f65cb323d399f731c20caf63f5a> introduced
testDomainGetEmulatorPinInfo() into test driver but used
virHostCPUGetCount() function to get the number of host CPUs.

This would be correct for other drivers but in test driver we must not
depend on the host, we have to use hard-coded host representation that
we have in test driver.

Follows the logic of testDomainGetVcpuPinInfo().

Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
 src/test/test_driver.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index a75c992af1..d582c207f4 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -2764,6 +2764,7 @@ testDomainGetEmulatorPinInfo(virDomainPtr dom,
                              int maplen,
                              unsigned int flags)
 {
+    testDriverPtr driver = dom->conn->privateData;
     virDomainObjPtr vm = NULL;
     virDomainDefPtr def = NULL;
     virBitmapPtr cpumask = NULL;
@@ -2780,8 +2781,7 @@ testDomainGetEmulatorPinInfo(virDomainPtr dom,
     if (!(def = virDomainObjGetOneDef(vm, flags)))
         goto cleanup;
 
-    if ((hostcpus = virHostCPUGetCount()) < 0)
-        goto cleanup;
+    hostcpus = VIR_NODEINFO_MAXCPUS(driver->nodeInfo);
 
     if (def->cputune.emulatorpin) {
         cpumask = def->cputune.emulatorpin;
-- 
2.26.2




More information about the libvir-list mailing list