]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
slirp: leave the dbus daemon running on error
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Wed, 8 Apr 2020 17:23:46 +0000 (19:23 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 22 Apr 2020 07:58:10 +0000 (09:58 +0200)
Don't stop the DBus daemon if a slirp helper failed to start, as it
may be shared with other helpers.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_slirp.c

index 09c1247892d2d625b6ccf6dcf6dfb3a190954eee..815156da5db388500a8495debe78393ede08c1bf 100644 (file)
@@ -258,6 +258,7 @@ qemuSlirpStart(qemuSlirpPtr slirp,
     int exitstatus = 0;
     int cmdret = 0;
     VIR_AUTOCLOSE errfd = -1;
+    bool killDBusDaemon = false;
 
     if (incoming &&
         !qemuSlirpHasFeature(slirp, QEMU_SLIRP_FEATURE_MIGRATE)) {
@@ -306,6 +307,9 @@ qemuSlirpStart(qemuSlirpPtr slirp,
         g_autofree char *id = qemuSlirpGetDBusVMStateId(net);
         g_autofree char *dbus_addr = qemuDBusGetAddress(driver, vm);
 
+        /* If per VM DBus daemon is not running yet, start it
+         * now. But if we fail later on, make sure to kill it. */
+        killDBusDaemon = !QEMU_DOMAIN_PRIVATE(vm)->dbusDaemonRunning;
         if (qemuDBusStart(driver, vm) < 0)
             return -1;
 
@@ -355,6 +359,7 @@ qemuSlirpStart(qemuSlirpPtr slirp,
         virProcessKillPainfully(pid, true);
     if (pidfile)
         unlink(pidfile);
-    qemuDBusStop(driver, vm);
+    if (killDBusDaemon)
+        qemuDBusStop(driver, vm);
     return -1;
 }