[PATCH v2 4/8] remote: notify systemd when reloading config

Daniel P. Berrangé posted 8 patches 10 months, 1 week ago
[PATCH v2 4/8] remote: notify systemd when reloading config
Posted by Daniel P. Berrangé 10 months, 1 week ago
Switch to the 'notify-reload' service type and send notifications to
systemd when reloading configuration.

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

diff --git a/src/remote/libvirtd.service.in b/src/remote/libvirtd.service.in
index 250b4a6fc3..b0a062e885 100644
--- a/src/remote/libvirtd.service.in
+++ b/src/remote/libvirtd.service.in
@@ -26,7 +26,7 @@ After=xencommons.service
 Conflicts=xendomains.service
 
 [Service]
-Type=notify
+Type=notify-reload
 Environment=LIBVIRTD_ARGS="--timeout 120"
 EnvironmentFile=-@initconfdir@/libvirtd
 ExecStart=@sbindir@/libvirtd $LIBVIRTD_ARGS
diff --git a/src/remote/remote_daemon.c b/src/remote/remote_daemon.c
index 1d079c7e4b..d44a365000 100644
--- a/src/remote/remote_daemon.c
+++ b/src/remote/remote_daemon.c
@@ -452,9 +452,11 @@ static void daemonReloadHandlerThread(void *opaque G_GNUC_UNUSED)
     virHookCall(VIR_HOOK_DRIVER_DAEMON, "-",
                 VIR_HOOK_DAEMON_OP_RELOAD, SIGHUP, "SIGHUP", NULL, NULL);
 
+    virSystemdNotifyReload();
     if (virStateReload() < 0) {
         VIR_WARN("Error while reloading drivers");
     }
+    virSystemdNotifyReady();
 
     /* Drivers are initialized again. */
     g_atomic_int_set(&driversInitialized, 1);
diff --git a/src/virtd.service.in b/src/virtd.service.in
index 651a8d82d7..7ffb77e339 100644
--- a/src/virtd.service.in
+++ b/src/virtd.service.in
@@ -15,7 +15,7 @@ After=dbus.service
 After=apparmor.service
 
 [Service]
-Type=notify
+Type=notify-reload
 Environment=@SERVICE@_ARGS="--timeout 120"
 EnvironmentFile=-@initconfdir@/@service@
 ExecStart=@sbindir@/@service@ $@SERVICE@_ARGS
-- 
2.47.1
Re: [PATCH v2 4/8] remote: notify systemd when reloading config
Posted by Peter Krempa 10 months, 1 week ago
On Wed, Feb 12, 2025 at 15:46:42 +0000, Daniel P. Berrangé wrote:
> Switch to the 'notify-reload' service type and send notifications to
> systemd when reloading configuration.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>  src/remote/libvirtd.service.in | 2 +-
>  src/remote/remote_daemon.c     | 2 ++
>  src/virtd.service.in           | 2 +-
>  3 files changed, 4 insertions(+), 2 deletions(-)

Reviewed-by: Peter Krempa <pkrempa@redhat.com>