[libvirt PATCH 10/42] systemd: Make @sockprefix@ optional

Andrea Bolognani posted 42 patches 2 years, 4 months ago
There is a newer version of this series
[libvirt PATCH 10/42] systemd: Make @sockprefix@ optional
Posted by Andrea Bolognani 2 years, 4 months ago
For most services, the socket paths can be derived trivially from
the name of the daemon: for virtqemud, for example, they will be

  /run/libvirt/virtqemud-sock
  /run/libvirt/virtqemud-sock-ro
  /run/libvirt/virtqemud-admin-sock

libvirtd and virtproxyd are the exceptions, since their socket
paths will be

  /run/libvirt/libvirt-sock
  /run/libvirt/libvirt-sock-ro
  /run/libvirt/libvirt-admin-sock

So we still need to be able to provide a custom @sockprefix@ in
those cases, but in the most common scenario we can do away with
the requirement by introducing a sensible default.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
 src/meson.build | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/meson.build b/src/meson.build
index 9d5085a8aa..6c85cc9b9b 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -196,7 +196,7 @@ guest_unit_files = []
 #   * service - name of the service (required)
 #   * service_in - service source file (required)
 #   * name - socket description (required)
-#   * sockprefix - socket prefix name (required)
+#   * sockprefix - socket prefix name (optional, default unit['service'])
 #   * sockets - array of additional sockets (optional, default [ 'main', 'ro', 'admin' ])
 #   * socket_$name_in - additional socket source files (optional, default remote/libvirtd.socket.in )
 #   * deps - socket dependencies (optional, default '')
@@ -811,7 +811,7 @@ if conf.has('WITH_LIBVIRTD')
         'initconfdir': initconfdir,
         'name': unit['name'],
         'service': unit['service'],
-        'sockprefix': unit['sockprefix'],
+        'sockprefix': unit.get('sockprefix', unit['service']),
         'deps': unit.get('deps', ''),
         'sockmode': sockmode,
       })
-- 
2.41.0
Re: [libvirt PATCH 10/42] systemd: Make @sockprefix@ optional
Posted by Daniel P. Berrangé 2 years, 4 months ago
On Mon, Sep 25, 2023 at 08:58:08PM +0200, Andrea Bolognani wrote:
> For most services, the socket paths can be derived trivially from
> the name of the daemon: for virtqemud, for example, they will be
> 
>   /run/libvirt/virtqemud-sock
>   /run/libvirt/virtqemud-sock-ro
>   /run/libvirt/virtqemud-admin-sock
> 
> libvirtd and virtproxyd are the exceptions, since their socket
> paths will be
> 
>   /run/libvirt/libvirt-sock
>   /run/libvirt/libvirt-sock-ro
>   /run/libvirt/libvirt-admin-sock
> 
> So we still need to be able to provide a custom @sockprefix@ in
> those cases, but in the most common scenario we can do away with
> the requirement by introducing a sensible default.
> 
> Signed-off-by: Andrea Bolognani <abologna@redhat.com>
> ---
>  src/meson.build | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

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 :|