On 04/03/2012 06:48 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange(a)redhat.com>
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,
+
+%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.
--
Eric Blake eblake(a)redhat.com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org