From 09fc61264ae75cee3c5617a054a7e745a203e907 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Fri, 29 May 2015 14:29:06 +0200 Subject: [PATCH] qemu: Refactor qemuDomainGetEmulatorPinInfo by reusing virDomainObjGetDefs --- src/qemu/qemu_driver.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 6b7be57dfe..f417f2333a 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -5402,14 +5402,13 @@ qemuDomainGetEmulatorPinInfo(virDomainPtr dom, int maplen, unsigned int flags) { - virQEMUDriverPtr driver = dom->conn->privateData; virDomainObjPtr vm = NULL; - virDomainDefPtr targetDef = NULL; + virDomainDefPtr def; + virDomainDefPtr targetDef; int ret = -1; int hostcpus; virBitmapPtr cpumask = NULL; virBitmapPtr bitmap = NULL; - virCapsPtr caps = NULL; virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1); @@ -5420,18 +5419,11 @@ qemuDomainGetEmulatorPinInfo(virDomainPtr dom, if (virDomainGetEmulatorPinInfoEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (!(caps = virQEMUDriverGetCapabilities(driver, false))) + if (virDomainObjGetDefs(vm, flags, &def, &targetDef) < 0) goto cleanup; - if (virDomainLiveConfigHelperMethod(caps, driver->xmlopt, - vm, &flags, &targetDef) < 0) - goto cleanup; - - if (flags & VIR_DOMAIN_AFFECT_LIVE) - targetDef = vm->def; - - /* Coverity didn't realize that targetDef must be set if we got here. */ - sa_assert(targetDef); + if (def) + targetDef = def; if ((hostcpus = nodeGetCPUCount()) < 0) goto cleanup; @@ -5453,7 +5445,6 @@ qemuDomainGetEmulatorPinInfo(virDomainPtr dom, cleanup: virDomainObjEndAPI(&vm); - virObjectUnref(caps); virBitmapFree(bitmap); return ret; }