[PATCH 8/8] Restart daemon at end of transaction

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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(-)

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
+
+%posttrans daemon
+%if %{with_systemd}
 if [ $1 -ge 1 ] ; then
     # Package upgrade, not uninstall
     /bin/systemctl try-restart libvirtd.service >/dev/null 2>&1 || :
 fi
+%else
+if [ "$1" -ge "1" ]; then
+    /sbin/service libvirtd condrestart > /dev/null 2>&1
+fi
 %endif
 
 %if %{with_network}
-- 
1.7.7.6

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]