[libvirt PATCH 36/42] systemd: Augment Requires/Wants with After

Andrea Bolognani posted 42 patches 2 years, 4 months ago
There is a newer version of this series
[libvirt PATCH 36/42] systemd: Augment Requires/Wants with After
Posted by Andrea Bolognani 2 years, 4 months ago
Requires/Wants only tells systemd that the corresponding unit
should be started when the current one is, but that could very
well happen in parallel. For virtlogd/virtlockd, we want the
socket to be already active when the hypervisor driver is
started.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
 src/libxl/meson.build          | 1 +
 src/qemu/meson.build           | 2 ++
 src/remote/libvirtd.service.in | 7 ++++++-
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/libxl/meson.build b/src/libxl/meson.build
index e84999e14d..ad8d9b757f 100644
--- a/src/libxl/meson.build
+++ b/src/libxl/meson.build
@@ -69,6 +69,7 @@ if conf.has('WITH_LIBXL')
     'name': 'Libvirt libxl',
     'service_unit_extra': [
       'Wants=virtlockd.socket',
+      'After=virtlockd.socket',
       'After=remote-fs.target',
       'After=xencommons.service',
       'Conflicts=xendomains.service',
diff --git a/src/qemu/meson.build b/src/qemu/meson.build
index 7e5db09e0c..bf900e3f14 100644
--- a/src/qemu/meson.build
+++ b/src/qemu/meson.build
@@ -187,6 +187,8 @@ if conf.has('WITH_QEMU')
     'service_unit_extra': [
       'Requires=virtlogd.socket',
       'Wants=virtlockd.socket',
+      'After=virtlogd.socket',
+      'After=virtlockd.socket',
       'Wants=systemd-machined.service',
       'After=systemd-machined.service',
       'After=remote-fs.target',
diff --git a/src/remote/libvirtd.service.in b/src/remote/libvirtd.service.in
index 8839c00a15..a2c3c8f8fa 100644
--- a/src/remote/libvirtd.service.in
+++ b/src/remote/libvirtd.service.in
@@ -1,13 +1,18 @@
 [Unit]
 Description=Virtualization daemon
-Requires=virtlogd.socket
 # Use Wants instead of Requires so that users
 # can disable these three .socket units to revert
 # to a traditional non-activation deployment setup
 Wants=libvirtd.socket
 Wants=libvirtd-ro.socket
 Wants=libvirtd-admin.socket
+After=libvirtd.socket
+After=libvirtd-ro.socket
+After=libvirtd-admin.socket
+Requires=virtlogd.socket
 Wants=virtlockd.socket
+After=virtlogd.socket
+After=virtlockd.socket
 Wants=systemd-machined.service
 After=network.target
 After=dbus.service
-- 
2.41.0
Re: [libvirt PATCH 36/42] systemd: Augment Requires/Wants with After
Posted by Daniel P. Berrangé 2 years, 4 months ago
On Mon, Sep 25, 2023 at 08:58:34PM +0200, Andrea Bolognani wrote:
> Requires/Wants only tells systemd that the corresponding unit
> should be started when the current one is, but that could very
> well happen in parallel. For virtlogd/virtlockd, we want the
> socket to be already active when the hypervisor driver is
> started.
> 
> Signed-off-by: Andrea Bolognani <abologna@redhat.com>
> ---
>  src/libxl/meson.build          | 1 +
>  src/qemu/meson.build           | 2 ++
>  src/remote/libvirtd.service.in | 7 ++++++-
>  3 files changed, 9 insertions(+), 1 deletion(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|