[meta-virtualization] [PATCH] dnsmasq: allow for multiple instances (per libvirt)

Mark Asselstine mark.asselstine at windriver.com
Thu Sep 10 10:59:12 PDT 2015


We have had a persistent issue of contention with multiple instances
of dnsmasq. When libvirtd is started it will attempt and fail to
create virbr0 that includes a dnsmasq binding (dnsmasq complains that
the port is already in use). The root cause being that the base
dnsmasq configuration uses the 'default' binding, meaning it will be
greedy and bind to all available interfaces, along with any new
interfaces that appear. This prevents any new instances of dnsmasq to
fail. By changing the base dnsmasq configuration to use 'bind-dynamic'
we will be able to create new interfaces and if we want to attach a
new dnsmasq instance for the new interface we can, without contention.

Overall this change should not change the default behavior (other then
fixing the contention) as the 'bind-dynamic' mode will allow the base
config to attach to new interfaces which are not be bound to new
dnsmasq instances.

Removing dnsmasq_exclude_virbr.conf which was a previous (partial)
attempt that was made to resolve this issue.

Signed-off-by: Mark Asselstine <mark.asselstine at windriver.com>
---
 recipes-extended/libvirt/libvirt/dnsmasq_exclude_virbr.conf | 1 -
 recipes-support/dnsmasq/dnsmasq_2.%.bbappend                | 5 +++++
 2 files changed, 5 insertions(+), 1 deletion(-)
 delete mode 100644 recipes-extended/libvirt/libvirt/dnsmasq_exclude_virbr.conf
 create mode 100644 recipes-support/dnsmasq/dnsmasq_2.%.bbappend

diff --git a/recipes-extended/libvirt/libvirt/dnsmasq_exclude_virbr.conf b/recipes-extended/libvirt/libvirt/dnsmasq_exclude_virbr.conf
deleted file mode 100644
index 16bf198..0000000
--- a/recipes-extended/libvirt/libvirt/dnsmasq_exclude_virbr.conf
+++ /dev/null
@@ -1 +0,0 @@
-except-interface=virbr0
diff --git a/recipes-support/dnsmasq/dnsmasq_2.%.bbappend b/recipes-support/dnsmasq/dnsmasq_2.%.bbappend
new file mode 100644
index 0000000..8d66ca6
--- /dev/null
+++ b/recipes-support/dnsmasq/dnsmasq_2.%.bbappend
@@ -0,0 +1,5 @@
+# dnsmasq is greedy with interfaces by default using bind-dynamic will
+# make it less greedy but still function as it did by default.
+do_install_append() {
+    sed -i '/#bind-interfaces/a # Play nice with libvirt\nbind-dynamic' ${D}${sysconfdir}/dnsmasq.conf
+}
-- 
2.1.4



More information about the meta-virtualization mailing list