On Tue, Apr 03, 2012 at 10:06:05PM -0600, Eric Blake wrote: > On 04/03/2012 06:48 AM, Daniel P. Berrange wrote: > > From: "Daniel P. Berrange" <berrange@xxxxxxxxxx> > > > > It is not safe to restart libvirtd after install of the > > libvirt-daemon RPM, since the corresponding driver modules > > may not yet have been installed by RPM. The solution is to > > move the restart logic to a %posttrans script. This runs > > at completion of the RPM transaction, once everything is > > uninstalled. > > --- > > libvirt.spec.in | 13 +++++++++---- > > 1 files changed, 9 insertions(+), 4 deletions(-) > > I haven't used %posttrans before, but it looks simple enough. What I'm > not sure of... > > > > > diff --git a/libvirt.spec.in b/libvirt.spec.in > > index d867b09..73e1ec3 100644 > > --- a/libvirt.spec.in > > +++ b/libvirt.spec.in > > @@ -1188,9 +1188,6 @@ fi > > %endif > > > > /sbin/chkconfig --add libvirtd > > -if [ "$1" -ge "1" ]; then > > - /sbin/service libvirtd condrestart > /dev/null 2>&1 > > -fi > > %endif > > > > %preun daemon > > @@ -1207,13 +1204,21 @@ if [ $1 = 0 ]; then > > fi > > %endif > > > > -%postun daemon > > %if %{with_systemd} > > +%postun daemon > > /bin/systemctl daemon-reload >/dev/null 2>&1 || : > > +%endif > > is why daemon-reload can be done right away, This tells systemd to re-read the .unit and .service files, but not take any action. > > +%posttrans daemon > > +%if %{with_systemd} > > if [ $1 -ge 1 ] ; then > > # Package upgrade, not uninstall > > /bin/systemctl try-restart libvirtd.service >/dev/null 2>&1 || : > > but a full restart has to wait for %posttrans. I was naively assuming > they should both be %posttrans. And this actually makes systemd take some actions. I guess we could also postpone the daemon-reload to %posttrans without any ill-effects though. Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list