libvirt/tools/libvirt-guests.service.in
Martin Kletzander 4e42686ade Make systemd unit ordering more robust
Since libvirt-guests script/service can operate on various URIs and we do
support both socket activation and traditional services, the ordering should be
specified for all the possible sockets and services.

Also remove the Wants= dependency since do not want to start any service.  We
cannot know which one libvirt-guests is configured, so we'd have to start all
the daemons which would break if unused colliding services are not
masked (libvirtd.service in the modular case and all the modular daemon service
units in the monolithic scenario).  Fortunately we can assume that the system is
configured properly to start services/sockets that are of interest to the user.
That also works with the setup described in https://libvirt.org/daemons.html .

To make it even more robust we add the daemon service into the machine units
created for individual domains as it was missing there.

https://bugzilla.redhat.com/show_bug.cgi?id=1868537

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2022-02-22 13:35:47 +01:00

35 lines
857 B
SYSTEMD

[Unit]
Description=Suspend/Resume Running libvirt Guests
Requires=virt-guest-shutdown.target
After=network.target
After=time-sync.target
After=libvirtd.socket
After=virtqemud.socket
After=virtlxcd.socket
After=virtvboxd.socket
After=virtvzd.socket
After=virtxend.socket
After=libvirtd.service
After=virtqemud.service
After=virtlxcd.service
After=virtvboxd.service
After=virtvzd.service
After=virtxend.service
After=virt-guest-shutdown.target
Documentation=man:libvirt-guests(8)
Documentation=https://libvirt.org
[Service]
EnvironmentFile=-@sysconfdir@/sysconfig/libvirt-guests
# Hack just call traditional service until we factor
# out the code
ExecStart=@libexecdir@/libvirt-guests.sh start
ExecStop=@libexecdir@/libvirt-guests.sh stop
Type=oneshot
RemainAfterExit=yes
StandardOutput=journal+console
TimeoutStopSec=0
[Install]
WantedBy=multi-user.target