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

[libvirt] [PATCH 2/2] qemu: Don't duplicate domain def in qemuDomainGetFSInfo



Introduced in v3.0.0-rc1~336, the commit message doesn't really
justifies the expensive domain def copy creation. Now, that
vm->def is guarded in this function by job acquirement we can use
vm->def directly.

Signed-off-by: Michal Privoznik <mprivozn redhat com>
---
 src/qemu/qemu_driver.c | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 2b70f9f83e..d0e67863ea 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -22126,11 +22126,8 @@ qemuDomainGetFSInfo(virDomainPtr dom,
                     unsigned int flags)
 {
     virQEMUDriverPtr driver = dom->conn->privateData;
-    qemuDomainObjPrivatePtr priv;
     virDomainObjPtr vm;
     qemuAgentPtr agent;
-    virCapsPtr caps = NULL;
-    virDomainDefPtr def = NULL;
     int ret = -1;
 
     virCheckFlags(0, ret);
@@ -22138,8 +22135,6 @@ qemuDomainGetFSInfo(virDomainPtr dom,
     if (!(vm = qemuDomObjFromDomain(dom)))
         return ret;
 
-    priv = vm->privateData;
-
     if (virDomainGetFSInfoEnsureACL(dom->conn, vm->def) < 0)
         goto cleanup;
 
@@ -22154,14 +22149,8 @@ qemuDomainGetFSInfo(virDomainPtr dom,
     if (!qemuDomainAgentAvailable(vm, true))
         goto endjob;
 
-    if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
-        goto endjob;
-
-    if (!(def = virDomainDefCopy(vm->def, caps, driver->xmlopt, priv->qemuCaps, false)))
-        goto endjob;
-
     agent = qemuDomainObjEnterAgent(vm);
-    ret = qemuAgentGetFSInfo(agent, info, def);
+    ret = qemuAgentGetFSInfo(agent, info, vm->def);
     qemuDomainObjExitAgent(vm, agent);
 
  endjob:
@@ -22169,8 +22158,6 @@ qemuDomainGetFSInfo(virDomainPtr dom,
 
  cleanup:
     virDomainObjEndAPI(&vm);
-    virDomainDefFree(def);
-    virObjectUnref(caps);
     return ret;
 }
 
-- 
2.21.0


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