When upgrading libvirt packages, there's no strict ordering for the installation or removal of the individual libvirt sub packages. Thus libvirt-daemon may be upgraded (and its %postun scriptlet) started before all sub packages with driver libraries are upgraded. When libvirt-daemon's %postun scriptlet restarts the daemon old drivers may still be laying around and the daemon may crash when it tries to use them. Let's restart the daemon in %posttrans to make sure libvirtd is restarted only after all sub packages are at the same version. https://bugzilla.redhat.com/show_bug.cgi?id=1464300 Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx> --- libvirt.spec.in | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index 0123d0655..b00689cab 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -1516,6 +1516,10 @@ fi /sbin/chkconfig --add virtlockd %endif +# request daemon restart in posttrans +mkdir -p %{_localstatedir}/lib/rpm-state/libvirt || : +touch %{_localstatedir}/lib/rpm-state/libvirt/restart || : + %preun daemon %if %{with_systemd} %if %{with_systemd_macros} @@ -1554,13 +1558,11 @@ fi if [ $1 -ge 1 ] ; then /bin/systemctl reload-or-try-restart virtlockd.service >/dev/null 2>&1 || : /bin/systemctl reload-or-try-restart virtlogd.service >/dev/null 2>&1 || : - /bin/systemctl try-restart libvirtd.service >/dev/null 2>&1 || : fi %else if [ $1 -ge 1 ]; then /sbin/service virtlockd reload > /dev/null 2>&1 || : /sbin/service virtlogd reload > /dev/null 2>&1 || : - /sbin/service libvirtd condrestart > /dev/null 2>&1 fi %endif @@ -1570,7 +1572,6 @@ fi if [ "$1" -ge "1" ]; then /sbin/service virtlockd reload > /dev/null 2>&1 || : /sbin/service virtlogd reload > /dev/null 2>&1 || : - /sbin/service libvirtd condrestart > /dev/null 2>&1 fi %endif @@ -1593,6 +1594,16 @@ if [ $1 -ge 1 ] ; then %endif fi +%posttrans daemon +if [ -f %{_localstatedir}/lib/rpm-state/libvirt/restart ]; then +%if %{with_systemd} + /bin/systemctl try-restart libvirtd.service >/dev/null 2>&1 || : +%else + /sbin/service libvirtd condrestart > /dev/null 2>&1 || : +%endif +fi +rm -rf %{_localstatedir}/lib/rpm-state/libvirt || : + %post daemon-config-network if test $1 -eq 1 && test ! -f %{_sysconfdir}/libvirt/qemu/networks/default.xml ; then # see if the network used by default network creates a conflict, @@ -1631,23 +1642,35 @@ if test $1 -eq 1 && test ! -f %{_sysconfdir}/libvirt/qemu/networks/default.xml ; ln -s ../default.xml %{_sysconfdir}/libvirt/qemu/networks/autostart/default.xml # Make sure libvirt picks up the new network defininiton + mkdir -p %{_localstatedir}/lib/rpm-state/libvirt || : + touch %{_localstatedir}/lib/rpm-state/libvirt/restart || : +fi + +%posttrans daemon-config-network +if [ -f %{_localstatedir}/lib/rpm-state/libvirt/restart ]; then %if %{with_systemd} - /bin/systemctl try-restart libvirtd.service >/dev/null 2>&1 ||: + /bin/systemctl try-restart libvirtd.service >/dev/null 2>&1 || : %else /sbin/service libvirtd condrestart > /dev/null 2>&1 || : %endif - fi - +rm -rf %{_localstatedir}/lib/rpm-state/libvirt || : %post daemon-config-nwfilter cp %{_datadir}/libvirt/nwfilter/*.xml %{_sysconfdir}/libvirt/nwfilter/ # Make sure libvirt picks up the new nwfilter defininitons +mkdir -p %{_localstatedir}/lib/rpm-state/libvirt || : +touch %{_localstatedir}/lib/rpm-state/libvirt/restart || : + +%posttrans daemon-config-nwfilter +if [ -f %{_localstatedir}/lib/rpm-state/libvirt/restart ]; then %if %{with_systemd} - /bin/systemctl try-restart libvirtd.service >/dev/null 2>&1 ||: + /bin/systemctl try-restart libvirtd.service >/dev/null 2>&1 || : %else /sbin/service libvirtd condrestart > /dev/null 2>&1 || : %endif +fi +rm -rf %{_localstatedir}/lib/rpm-state/libvirt || : %if %{with_systemd} -- 2.14.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list