[PATCH 22/26] rpc: don't unconditionally quit after preserving state

Daniel P. Berrangé posted 26 patches 1 week, 5 days ago
[PATCH 22/26] rpc: don't unconditionally quit after preserving state
Posted by Daniel P. Berrangé 1 week, 5 days ago
The call to preserve state (ie running VMs) is triggered in response to
the desktop session dbus terminating (session daemon), or logind sending
a "PrepareForShutdown" signal. In the case of the latter, daemons
should only save their state, not actually exit yet. Other things on the
system may still expect the daemon to be running at this stage.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 src/remote/remote_daemon.c | 4 +++-
 src/rpc/virnetdaemon.c     | 1 -
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/remote/remote_daemon.c b/src/remote/remote_daemon.c
index bf91ee5772..e03ee1de5a 100644
--- a/src/remote/remote_daemon.c
+++ b/src/remote/remote_daemon.c
@@ -526,8 +526,10 @@ handleSessionMessageFunc(GDBusConnection *connection G_GNUC_UNUSED,
 
     if (virGDBusMessageIsSignal(message,
                                 "org.freedesktop.DBus.Local",
-                                "Disconnected"))
+                                "Disconnected")) {
         virNetDaemonPreserve(dmn);
+        virNetDaemonQuit(dmn);
+    }
 
     return message;
 }
diff --git a/src/rpc/virnetdaemon.c b/src/rpc/virnetdaemon.c
index 19b19ff834..7f14c5420a 100644
--- a/src/rpc/virnetdaemon.c
+++ b/src/rpc/virnetdaemon.c
@@ -833,7 +833,6 @@ static void virNetDaemonPreserveWorker(void *opaque)
 
     VIR_DEBUG("Completed stop dmn=%p", dmn);
 
-    virNetDaemonQuit(dmn);
     virObjectUnref(dmn);
 }
 
-- 
2.47.1