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

[libvirt] [PATCH 34/35] 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 9c0f7d3..ea4e75b 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5398,14 +5398,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);
@@ -5416,18 +5415,11 @@ qemuDomainGetEmulatorPinInfo(virDomainPtr dom,
     if (virDomainGetEmulatorPinInfoEnsureACL(dom->conn, vm->def) < 0)
         goto cleanup;

-    if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
-        goto cleanup;
-
-    if (virDomainLiveConfigHelperMethod(caps, driver->xmlopt,
-                                        vm, &flags, &targetDef) < 0)
+    if (virDomainObjGetDefs(vm, flags, &def, &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;
@@ -5449,7 +5441,6 @@ qemuDomainGetEmulatorPinInfo(virDomainPtr dom,

  cleanup:
     virDomainObjEndAPI(&vm);
-    virObjectUnref(caps);
     virBitmapFree(bitmap);
     return ret;
 }
-- 
2.4.1


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