[libvirt PATCH 7/8] rpm: Switch to new macros for handling of systemd units

Andrea Bolognani abologna at redhat.com
Tue Jul 25 14:52:33 UTC 2023


On Tue, Jul 25, 2023 at 03:52:08PM +0200, Martin Kletzander wrote:
> On Fri, Jul 14, 2023 at 04:39:41PM +0200, Andrea Bolognani wrote:
> > In most cases the replacement is straightforward, with the
> > biggest difference being that we now schedule restarts during
> > %pre instead of %post. This also means that we can get rid of
> > %post for most packages, reducing the number of scriptlets that
> > need to run during install/upgrade.
> >
> > Notable exceptions are libvirt-guests.service, where we stop
> > using the standard systemd macros to adopt our custom ones, as
> > well as the virtlogd and virtlockd services, where the reload
> > operation is moved from %postun to %posttrans.
>
> That would mean the reload is called on package install, but that's
> still better than nothing.  Feel free to add [ "$1" -gt 1 ] around it
> somewhere if you want, but I don't think that's necessary.

We call 'systemctl try-reload-or-restart', which means that the unit
will only be reloaded if it's already running. So, during the initial
install, nothing will happen, and a reload will only be performed on
upgrade *and* if the service is not in stopped state. Same thing for
restarts.

In other words, I don't think checking $1 is necessary either :)

-- 
Andrea Bolognani / Red Hat / Virtualization



More information about the libvir-list mailing list