2023-09-19 17:28:55 +00:00
|
|
|
[Unit]
|
2023-09-25 14:06:09 +00:00
|
|
|
Description=libvirt @name@ daemon admin socket
|
2023-09-19 17:28:55 +00:00
|
|
|
BindsTo=@service@.socket
|
|
|
|
After=@service@.socket
|
systemd: Make modular daemons conflict with libvirtd
We want to make sure that, at any given time, we have either the
modular daemons or the monolithic one running, never both. In
order to achieve that, make every single modular unit conflict
with the corresponding libvirtd unit.
We set both Conflicts=libvirtd.unit and After=libvirtd.unit: this
tells systemd that, whenever virtfood.unit and libvirtd.unit are
part of the same transaction, the former should win out.
Thanks to this, if both the modular daemons and the monolithic
one have been enabled because of outdated automation or a simple
mistake of the administrator, the request to start libvirtd at
boot will be ignored and the result will be a regular modular
deployment.
If the request to start libvirtd is made when the modular daemons
are already running, we have no way to prevent systemd from
complying with that request; however, thanks to the way the
conflict relationship has been declared, they will be shut down
cleanly before libvirtd is started. From the user's point of
view, the transition from modular to monolithic will be
completely transparent: it's basically the same scenario as a
regular package upgrade, just with an extra twist.
Note that, while switching from modular to monolithic at runtime
happens automatically, going back requires manual intervention,
i.e. starting all the necessary sockets one by one. That's okay:
the goal here is to prevent misconfiguration and force of habit
to accidentally disrupt a working setup, not to encourage the
scenario. In a correctly configured and managed host, it should
never occur.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2023-09-25 15:24:10 +00:00
|
|
|
Conflicts=libvirtd-admin.socket
|
|
|
|
After=libvirtd-admin.socket
|
2023-09-19 17:28:55 +00:00
|
|
|
|
|
|
|
[Socket]
|
|
|
|
ListenStream=@runstatedir@/libvirt/@sockprefix@-admin-sock
|
|
|
|
Service=@service@.service
|
|
|
|
SocketMode=0600
|
2023-09-27 15:13:32 +00:00
|
|
|
RemoveOnStop=yes
|
2023-09-19 17:28:55 +00:00
|
|
|
|
|
|
|
[Install]
|
|
|
|
WantedBy=sockets.target
|
2023-09-25 15:24:34 +00:00
|
|
|
Also=@service@.socket
|
|
|
|
Also=@service@-ro.socket
|