libvirt-guests: Fix dependency ordering in service file

After some debugging and discussion with systemd team it turns out we
are misusing the ordering in libvirt-guests.service.  That happened
because we want to support both monolithic and modular daemon setups and
on top of that we also want to support socket activation and services
without socket activation.  Unfortunately this is impossible to express
in the unit file because of how transactions are handled in systemd when
dependencies are resolved and multiple actions (jobs) are queued.  For
explanation from Michal Sekletar see comment #7 in the BZ this patch is
fixing:

https://bugzilla.redhat.com/show_bug.cgi?id=1964855#c7

In order to support all the scenarios this patch also amends the
manpages so that users that are changing the default can also read how
to correct the dependency ordering in libvirt-guests unit file.

Ideally we would also keep the existing configuration during upgrade,
but due to our huge support matrix this seems hardly feasible as it
could introduce even more problems.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Martin Kletzander 2022-08-30 08:29:53 +02:00
parent e9fd6de8fc
commit 59d30adacd
7 changed files with 84 additions and 6 deletions

View File

@ -79,6 +79,20 @@ unit files must be masked:
$ systemctl mask libvirtd.socket libvirtd-ro.socket \
libvirtd-admin.socket libvirtd-tls.socket libvirtd-tcp.socket
If using libvirt-guests service then the ordering for that service needs to be
adapted so that it is ordered after the service unit instead of the socket unit.
Since dependencies and ordering cannot be changed with drop-in overrides, the
whole libvirt-guests unit file needs to be changed. In order to preserve such
change copy the installed ``/usr/lib/systemd/system/libvirt-guests.service`` to
``/etc/systemd/system/libvirt-guests.service`` and make the change there,
specifically make sure the ``After=`` ordering mentions ``libvirtd.service`` and
not ``libvirtd.socket``:
::
[Unit]
After=libvirtd.service
OPTIONS
=======

View File

@ -60,6 +60,20 @@ unit files must be masked:
$ systemctl mask virtlxcd.socket virtlxcd-ro.socket \
virtlxcd-admin.socket
If using libvirt-guests service then the ordering for that service needs to be
adapted so that it is ordered after the service unit instead of the socket unit.
Since dependencies and ordering cannot be changed with drop-in overrides, the
whole libvirt-guests unit file needs to be changed. In order to preserve such
change copy the installed ``/usr/lib/systemd/system/libvirt-guests.service`` to
``/etc/systemd/system/libvirt-guests.service`` and make the change there,
specifically make sure the ``After=`` ordering mentions ``virtlxcd.service`` and
not ``virtlxcd.socket``:
::
[Unit]
After=virtlxcd.service
OPTIONS
=======

View File

@ -60,6 +60,20 @@ unit files must be masked:
$ systemctl mask virtqemud.socket virtqemud-ro.socket \
virtqemud-admin.socket
If using libvirt-guests service then the ordering for that service needs to be
adapted so that it is ordered after the service unit instead of the socket unit.
Since dependencies and ordering cannot be changed with drop-in overrides, the
whole libvirt-guests unit file needs to be changed. In order to preserve such
change copy the installed ``/usr/lib/systemd/system/libvirt-guests.service`` to
``/etc/systemd/system/libvirt-guests.service`` and make the change there,
specifically make sure the ``After=`` ordering mentions ``virtqemud.service`` and
not ``virtqemud.socket``:
::
[Unit]
After=virtqemud.service
OPTIONS
=======

View File

@ -58,6 +58,20 @@ unit files must be masked:
$ systemctl mask virtvboxd.socket virtvboxd-ro.socket \
virtvboxd-admin.socket
If using libvirt-guests service then the ordering for that service needs to be
adapted so that it is ordered after the service unit instead of the socket unit.
Since dependencies and ordering cannot be changed with drop-in overrides, the
whole libvirt-guests unit file needs to be changed. In order to preserve such
change copy the installed ``/usr/lib/systemd/system/libvirt-guests.service`` to
``/etc/systemd/system/libvirt-guests.service`` and make the change there,
specifically make sure the ``After=`` ordering mentions ``virtvboxd.service`` and
not ``virtvboxd.socket``:
::
[Unit]
After=virtvboxd.service
OPTIONS
=======

View File

@ -60,6 +60,20 @@ unit files must be masked:
$ systemctl mask virtvzd.socket virtvzd-ro.socket \
virtvzd-admin.socket
If using libvirt-guests service then the ordering for that service needs to be
adapted so that it is ordered after the service unit instead of the socket unit.
Since dependencies and ordering cannot be changed with drop-in overrides, the
whole libvirt-guests unit file needs to be changed. In order to preserve such
change copy the installed ``/usr/lib/systemd/system/libvirt-guests.service`` to
``/etc/systemd/system/libvirt-guests.service`` and make the change there,
specifically make sure the ``After=`` ordering mentions ``virtvzd.service`` and
not ``virtvzd.socket``:
::
[Unit]
After=virtvzd.service
OPTIONS
=======

View File

@ -60,6 +60,20 @@ unit files must be masked:
$ systemctl mask virtxend.socket virtxend-ro.socket \
virtxend-admin.socket
If using libvirt-guests service then the ordering for that service needs to be
adapted so that it is ordered after the service unit instead of the socket unit.
Since dependencies and ordering cannot be changed with drop-in overrides, the
whole libvirt-guests unit file needs to be changed. In order to preserve such
change copy the installed ``/usr/lib/systemd/system/libvirt-guests.service`` to
``/etc/systemd/system/libvirt-guests.service`` and make the change there,
specifically make sure the ``After=`` ordering mentions ``virtxend.service`` and
not ``virtxend.socket``:
::
[Unit]
After=virtxend.service
OPTIONS
=======

View File

@ -9,12 +9,6 @@ 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