]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemuDomainAttachNetDevice: Don't construct network device properties under monitor...
authorPeter Krempa <pkrempa@redhat.com>
Mon, 9 May 2022 14:39:48 +0000 (16:39 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 16 May 2022 07:15:46 +0000 (09:15 +0200)
After the 'qemuFDPass' code was refactored we no longer need to hand off
the FD to qemu before we know the path for it.

Thus the call to qemuBuildHostNetProps can be moved outside of the
monitor critical section.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_hotplug.c

index d5bdeb83ae76b7ca3157b331f5c0ba6004eaea84..525c55baf221cf06bbb31c679ea71ac4fafa95d9 100644 (file)
@@ -1452,17 +1452,15 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver,
     for (i = 0; i < vhostfdSize; i++)
         vhostfdName[i] = g_strdup_printf("vhostfd-%s%zu", net->info.alias, i);
 
-    qemuDomainObjEnterMonitor(driver, vm);
-
-    if (qemuFDPassTransferMonitor(netpriv->vdpafd, priv->mon) < 0) {
-        qemuDomainObjExitMonitor(vm);
-        goto cleanup;
-    }
-
     if (!(netprops = qemuBuildHostNetProps(net,
                                            tapfdName, tapfdSize,
                                            vhostfdName, vhostfdSize,
-                                           slirpfdName))) {
+                                           slirpfdName)))
+        goto cleanup;
+
+    qemuDomainObjEnterMonitor(driver, vm);
+
+    if (qemuFDPassTransferMonitor(netpriv->vdpafd, priv->mon) < 0) {
         qemuDomainObjExitMonitor(vm);
         goto cleanup;
     }