[PATCH] qemu: lock: unlock vm during qemuBuildCommandLine

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

 



The function qemuBuildCommandLine() may take a long time, for example
if we configure tens of vifs for the guest, each may cost hundrands of
milliseconds to create tap dev, senconds in total. Thus, unlock vm
before calling it.

Signed-off-by: Zhang Bo <oscar.zhangbo@xxxxxxxxxx>
Signed-off-by: Zhou Yimin <zhouyimin@xxxxxxxxxx>
---
 src/qemu/qemu_process.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 753afe8..d1aaaec 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -4628,14 +4628,18 @@ int qemuProcessStart(virConnectPtr conn,
     }

     VIR_DEBUG("Building emulator command line");
+    virObjectUnlock(vm);
     if (!(cmd = qemuBuildCommandLine(conn, driver, vm->def, priv->monConfig,
                                      priv->monJSON, priv->qemuCaps,
                                      migrateFrom, stdin_fd, snapshot, vmop,
                                      &buildCommandLineCallbacks, false,
                                      qemuCheckFips(),
                                      priv->autoNodeset,
-                                     &nnicindexes, &nicindexes)))
+                                     &nnicindexes, &nicindexes))) {
+        virObjectLock(vm);
         goto cleanup;
+    }
+    virObjectLock(vm);

     /* now that we know it is about to start call the hook if present */
     if (virHookPresent(VIR_HOOK_DRIVER_QEMU)) {
-- 
1.7.12.4


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