[meta-virtualization] [PATCH 2/2] libvirt: Properly shutdown libvirtd.service

Mark Asselstine mark.asselstine at windriver.com
Wed Sep 16 09:26:38 PDT 2015


We build libvirt without support for sd_notify (dbus) therefor we have
to run libvirtd as a 'forking daemon' (per commit
055744cdbc1526d966091158c8fae2d22c905db4 we pass --daemon)

We need to update the systemd service file to reflect this such that
the libvirtd.service can be properly stopped. If we ever enable
sd_notify support in libvirt we can revert back to using the 'notify'
systemd type. Without this change libvirtd continue to run even if the
stop command is issued, subsequent attempts to start the service will
fail.

Signed-off-by: Mark Asselstine <mark.asselstine at windriver.com>
---
 recipes-extended/libvirt/libvirt_1.2.19.bb | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/recipes-extended/libvirt/libvirt_1.2.19.bb b/recipes-extended/libvirt/libvirt_1.2.19.bb
index f433321..df53d59 100644
--- a/recipes-extended/libvirt/libvirt_1.2.19.bb
+++ b/recipes-extended/libvirt/libvirt_1.2.19.bb
@@ -225,6 +225,11 @@ do_install_append() {
 	if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
 	    # This variable is used by libvirtd.service to start libvirtd in the right mode
 	    sed -i '/#LIBVIRTD_ARGS="--listen"/a LIBVIRTD_ARGS="--listen --daemon"' ${D}/${sysconfdir}/sysconfig/libvirtd
+
+	    # We can't use 'notify' when we don't support 'sd_notify' dbus capabilities.
+	    sed -i -e 's/Type=notify/Type=forking/' \
+	           -e '/Type=forking/a PIDFile=${localstatedir}/run/libvirtd.pid' \
+		   ${D}/${systemd_unitdir}/system/libvirtd.service
 	fi
 
 	# The /var/run/libvirt directories created by the Makefile
-- 
2.1.4



More information about the meta-virtualization mailing list