I needed the same flexibility on my network for several libvirtd
instances each running its own dnsmasq and requiring some complex
dnsmasq configuration to meld into the LAN configuration.

I added two new tags to the "<network>" XML: "conffile" and
"logfacility":

  <conffile name='/etc/libvirt/qemu/dnsmasq.conf'/>
  <logfacility name='/var/log/libvirt-dnsmasq.log'/>

If they are defined then their name attribute is passed to dnsmaq:

/usr/sbin/dnsmasq -u libvirt-dnsmasq --strict-order --bind-interfaces
--domain lan.domain.tld --pid-file=/var/run/libvirt/network/default.pid
--conf-file=/etc/libvirt/qemu/dnsmasq.conf --log-facility=/var/log
/libvirt-dnsmasq.log --except-interface lo --listen-address 10.254.1.1
--dhcp-range 10.254.1.101,10.254.1.254 --dhcp-
leasefile=/var/lib/libvirt/dnsmasq/default.leases --dhcp-lease-max=154
--dhcp-no-override --expand-hosts

which logs to:

$ sudo tail -f /var/log/libvirt-dnsmasq.log 
Feb 24 09:32:16 dnsmasq[4595]: started, version 2.59 cachesize 150
Feb 24 09:32:16 dnsmasq[4595]: compile time options: IPv6 GNU-getopt DBus i18n 
DHCP TFTP conntrack IDN
Feb 24 09:32:16 dnsmasq-dhcp[4595]: DHCP, IP range 10.254.1.101 -- 
10.254.1.254, lease time 1h
Feb 24 09:32:16 dnsmasq[4595]: using nameserver 10.254.251.1#53
Feb 24 09:32:16 dnsmasq[4595]: read /etc/hosts - 9 addresses
Feb 24 09:34:56 dnsmasq-dhcp[4595]: DHCPDISCOVER(virbr1) 10.254.1.244 
52:54:00:75:df:89 
Feb 24 09:34:56 dnsmasq-dhcp[4595]: DHCPOFFER(virbr1) 10.254.1.244 
52:54:00:75:df:89 
Feb 24 09:34:56 dnsmasq-dhcp[4595]: DHCPREQUEST(virbr1) 10.254.1.244 
52:54:00:75:df:89 
Feb 24 09:34:56 dnsmasq-dhcp[4595]: DHCPACK(virbr1) 10.254.1.244 
52:54:00:75:df:89 vm-ubuntu-raring-playpen

The attached patch is  for Ubuntu 12.04.2 Precise's libvirt
0.9.8-2ubuntu17.7 but should be usable for later releases too.

** Patch added: "sourcecode: diff to add --conf-file=... and --log-facility=... 
to libvirt 0.9.8-2ubuntu17.7"
   
https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/247583/+attachment/3544491/+files/dnsmasq-conf%2Blog.patch

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/247583

Title:
  add option to start dnsmasq with a custom configuration file

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/247583/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to