systemd: Make @sockprefix@ optional

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>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Andrea Bolognani 2023-09-19 17:25:27 +02:00
parent 6ed0cc1711
commit 1f78e9f910

View File

@ -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,
})