[PATCH] qemu: Fix emulator affinity

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

 



Commit ba63d8f7d843461f77a8206c1ef9da38388713e5 introduced a bug that
makes machines, that don't have either cpuset in <vcpu> or
<emulatorpin> specified, fail.  Because the function that sets
affinity is called without any check, the function must not fail
unless there is an error.
---
 src/qemu/qemu_process.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index e08ec67..b97aaef 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2029,22 +2029,24 @@ static int
 qemuProcessSetEmulatorAffinites(virConnectPtr conn,
                                 virDomainObjPtr vm)
 {
-    virBitmapPtr cpumask;
+    virBitmapPtr cpumask = NULL;
     virDomainDefPtr def = vm->def;
     virNodeInfo nodeinfo;
     int ret = -1;

-    if (virNodeGetInfo(conn, &nodeinfo) != 0)
-        return -1;
+    if (virNodeGetInfo(conn, &nodeinfo) < 0)
+        goto cleanup;

     if (def->cputune.emulatorpin)
         cpumask = def->cputune.emulatorpin->cpumask;
     else if (def->cpumask)
         cpumask = def->cpumask;
+
+    if (cpumask)
+        ret = virProcessInfoSetAffinity(vm->pid, cpumask);
     else
-        goto cleanup;
+        ret = 0;

-    ret = virProcessInfoSetAffinity(vm->pid, cpumask);
 cleanup:
     return ret;
 }
-- 
1.7.12.3

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