libvirt/src/virtd.service.in

28 lines
634 B
SYSTEMD
Raw Normal View History

[Unit]
Description=@name@ daemon
BindsTo=@service@.socket
Wants=@service@-ro.socket
Wants=@service@-admin.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.service
After=libvirtd.service
After=network.target
After=dbus.service
After=apparmor.service
Documentation=man:@service@(8)
Documentation=https://libvirt.org
[Service]
Type=notify
Environment=@SERVICE@_ARGS="--timeout 120"
EnvironmentFile=-@initconfdir@/@service@
ExecStart=@sbindir@/@service@ $@SERVICE@_ARGS
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
[Install]
WantedBy=multi-user.target
Also=@service@.socket
Also=@service@-ro.socket
Also=@service@-admin.socket