summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2015-12-07 12:48:04 +0000
committerDaniel P. Berrange <berrange@redhat.com>2015-12-08 11:08:16 +0000
commitda054f35ab3289c9114bc320338f14b3a88709b2 (patch)
tree14512e79ec0885f44d0d28c22558db6ac12642d7
parent5cce775e92784d30692055bbc8b52b2aa0c9d496 (diff)
downloadlibvirt-da054f35ab3289c9114bc320338f14b3a88709b2.tar.gz
rpm: explicitly enable & start virtlogd on install
When installing the libvirt-daemon RPM, we have a %post rule to enable the libvirtd.service, virtlockd.socket and virtlogd.socket files. This is only done, however, when the RPM is first installed, not when upgrading RPMs. So virtlogd will not get activated on upgrading, which is a problem as libvirt qemu driver will expect it to be available by default. This adds a trigger that is run when uninstalling libvirt-daemon older than 1.3.0 that will enable & start virtlogd.socket if libvirtd is enabled and/or started. Using the trigger rather than %post ensures that it only runs once, allowing admins to disable it explicitly thereafter without future upgrades re-enabling it. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
-rw-r--r--libvirt.spec.in19
1 files changed, 19 insertions, 0 deletions
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 1f76f2406c..ff25881809 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1779,6 +1779,25 @@ if [ "$1" -ge "1" ]; then
fi
%endif
+# In upgrade scenario we must explicitly enable virtlockd/virtlogd
+# sockets, if libvirtd is already enabled and start them if
+# libvirtd is running, otherwise you'll get failures to start
+# guests
+%triggerpostun daemon -- libvirt-daemon < 1.3.0
+if [ $1 -ge 1 ] ; then
+ %if %{with_systemd}
+ /bin/systemctl is-enabled libvirtd.service 1>/dev/null 2>&1 &&
+ /bin/systemctl enable virtlogd.socket || :
+ /bin/systemctl is-active libvirtd.service 1>/dev/null 2>&1 &&
+ /bin/systemctl start virtlogd.socket || :
+ %else
+ /sbin/chkconfig libvirtd 1>/dev/null 2>&1 &&
+ /bin/chkconfig virtlogd on || :
+ /sbin/service libvirtd status 1>/dev/null 2>&1 &&
+ /bin/service virtlogd start || :
+ %endif
+fi
+
%if %{with_network}
%post daemon-config-network
if test $1 -eq 1 && test ! -f %{_sysconfdir}/libvirt/qemu/networks/default.xml ; then