[meta-virtualization] [PATCH 3/4] libvirt: change how we make updates to the dnsmasq configuration

Mark Asselstine mark.asselstine at windriver.com
Tue Nov 22 10:56:15 PST 2016


Our old approach of making the default configuration of dnsmasq use
'bind-dynamic' has some negative side effects. ie. by making this
change when meta-virtualization is used but when libvirtd is not
installed in the rootfs we prevent dnsmasq from binding to all
interfaces (which is the expected/builtin default behavior of
dnsmasq). The results can also be non-deterministic when multiple
instances of dnsmasq are being run (which instance configured with
bind-dynamic should attend to new network interfaces?)

Additionally our approach modifies the default dnsmasq configuration
file which ideally should have now changes, allowing dnsmasq to be
configured using its builtin configuration values and also allowing
for other instances of dnsmasq to better reuse the default
configuration file.

These changes allow for better coexistence of libvirt with packages
like lxc which run their own instances of dnsmasq.

Signed-off-by: Mark Asselstine <mark.asselstine at windriver.com>
---
 recipes-extended/libvirt/libvirt/dnsmasq.libvirt-daemon | 2 ++
 recipes-extended/libvirt/libvirt_1.3.5.bb               | 6 ++++++
 2 files changed, 8 insertions(+)
 create mode 100644 recipes-extended/libvirt/libvirt/dnsmasq.libvirt-daemon

diff --git a/recipes-extended/libvirt/libvirt/dnsmasq.libvirt-daemon b/recipes-extended/libvirt/libvirt/dnsmasq.libvirt-daemon
new file mode 100644
index 0000000..a7c3059
--- /dev/null
+++ b/recipes-extended/libvirt/libvirt/dnsmasq.libvirt-daemon
@@ -0,0 +1,2 @@
+bind-interfaces
+except-interface=virbr0
diff --git a/recipes-extended/libvirt/libvirt_1.3.5.bb b/recipes-extended/libvirt/libvirt_1.3.5.bb
index c848c99..b8e8159 100644
--- a/recipes-extended/libvirt/libvirt_1.3.5.bb
+++ b/recipes-extended/libvirt/libvirt_1.3.5.bb
@@ -37,6 +37,7 @@ SRC_URI = "http://libvirt.org/sources/libvirt-${PV}.tar.gz;name=libvirt \
            file://0001-qemu-Let-empty-default-VNC-password-work-as-document.patch \
            file://0001-ptest-add-missing-test_helper-files.patch \
            file://0001-ptest-Remove-Windows-1252-check-from-esxutilstest.patch \
+           file://dnsmasq.libvirt-daemon \
           "
 
 SRC_URI[libvirt.md5sum] = "f9dc1e63d559eca50ae0ee798a4c6c6d"
@@ -112,6 +113,7 @@ FILES_${PN}-libvirtd = " \
 	${sbindir}/libvirtd \
 	${systemd_unitdir}/system/* \
 	${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '', '${libexecdir}/libvirt-guests.sh', d)} \
+	${sysconfdir}/dnsmasq.d/libvirt-daemon \
         "
 
 FILES_${PN}-virsh = "${bindir}/virsh"
@@ -258,6 +260,10 @@ do_install_append() {
 	for i in `find ${D}${libdir} -type f -name *.la`; do
 	    sed -i -e 's#-L${B}/src/.libs##g' $i
 	done
+
+	# ensure dnsmasq doesn't default to listenning on all interfaces
+	install -d ${D}/${sysconfdir}/dnsmasq.d
+	install -m 644 ${WORKDIR}/dnsmasq.libvirt-daemon ${D}/${sysconfdir}/dnsmasq.d/libvirt-daemon
 }
 
 EXTRA_OECONF += " \
-- 
2.7.4



More information about the meta-virtualization mailing list