]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
test: fix emulator pin info in test driver
authorPavel Hrdina <phrdina@redhat.com>
Fri, 7 Aug 2020 13:57:28 +0000 (15:57 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Sat, 8 Aug 2020 09:07:15 +0000 (11:07 +0200)
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@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
src/test/test_driver.c

index a75c992af1f667220e4c686f2dd29d6f20834cb8..d582c207f4c5a1fe32ee736141a6071701267af5 100644 (file)
@@ -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;