[PATCH 32/35] qemu: Refactor qemuDomainGetVcpuPinInfo by reusing virDomainObjGetDefs

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

 



---
 src/qemu/qemu_driver.c | 20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 2aa754d..1dfba58 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5198,13 +5198,11 @@ qemuDomainGetVcpuPinInfo(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, vcpu;
-    virCapsPtr caps = NULL;
     virBitmapPtr allcpumap = NULL;

     virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
@@ -5216,18 +5214,11 @@ qemuDomainGetVcpuPinInfo(virDomainPtr dom,
     if (virDomainGetVcpuPinInfoEnsureACL(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;
@@ -5265,7 +5256,6 @@ qemuDomainGetVcpuPinInfo(virDomainPtr dom,
  cleanup:
     virBitmapFree(allcpumap);
     virDomainObjEndAPI(&vm);
-    virObjectUnref(caps);
     return ret;
 }

-- 
2.4.1

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