On 2012年10月18日 21:51, Martin Kletzander wrote:
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;
It might be deserved to get rid of the "nodeinfo" together, as it's not used. Another patch is fine though.
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;
Personally I'd like get rid of the cleanup. As it doesn't do any cleanup work, waste of goto. :-) Regards, Osier -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list