[Pkg-libvirt-maintainers] Bug#605004: libvirt-bin: ignores domain element in network xml, so dnsmasq is not called with the --domain argument

pancho horrillo pancho at pancho.name
Fri Nov 26 06:15:58 UTC 2010


Package: libvirt-bin
Version: 0.8.3-4
Severity: normal

Hi.

I want to be able to resolv dns names of the VMs managed by libvirt.
For that, I use a system dnsmasq, which loads this config file:
$ cat /etc/dnsmasq.d/00_libvirtd.conf 
# only bind to loopback by default
interface=lo
bind-interfaces
server=/my.private.domain.example/192.168.122.1     # <-- added this
$ 

Thus, any request for a host in the my.private.domain.example will be
forwarded to the libvirt's private dnsmasq instance.

The problem is that libvirt is silently ignoring the domain element in
the default network xml.  This element is documented on 
sources: libvirt-0.8.3/docs/schemas/network.rng
and also in http://libvirt.org/formatnetwork.html (look for 'domain').

Let me show you this:


$ sudo LIBVIRT_DEBUG=1 virsh
06:34:31.864: debug : virInitialize:339 : register drivers
06:34:31.865: debug : virRegisterDriver:927 : registering Test as driver 0
06:34:31.865: debug : virRegisterNetworkDriver:733 : registering Test as network driver 0
06:34:31.865: debug : virRegisterInterfaceDriver:764 : registering Test as interface driver 0
06:34:31.865: debug : virRegisterStorageDriver:795 : registering Test as storage driver 0
06:34:31.865: debug : virRegisterDeviceMonitor:826 : registering Test as device driver 0
06:34:31.865: debug : virRegisterSecretDriver:857 : registering Test as secret driver 0
06:34:31.865: debug : virRegisterNWFilterDriver:888 : registering Test as network filter driver 0
06:34:31.865: debug : virRegisterDriver:927 : registering Xen as driver 1
06:34:31.865: debug : virRegisterDriver:927 : registering OPENVZ as driver 2
06:34:31.866: debug : vboxRegister:122 : VBoxCGlueInit failed, using dummy driver
06:34:31.866: debug : virRegisterDriver:927 : registering VBOX as driver 3
06:34:31.866: debug : virRegisterNetworkDriver:733 : registering VBOX as network driver 1
06:34:31.866: debug : virRegisterStorageDriver:795 : registering VBOX as storage driver 1
06:34:31.866: debug : virRegisterDriver:927 : registering remote as driver 4
06:34:31.866: debug : virRegisterNetworkDriver:733 : registering remote as network driver 2
06:34:31.866: debug : virRegisterInterfaceDriver:764 : registering remote as interface driver 1
06:34:31.866: debug : virRegisterStorageDriver:795 : registering remote as storage driver 2
06:34:31.866: debug : virRegisterDeviceMonitor:826 : registering remote as device driver 1
06:34:31.866: debug : virRegisterSecretDriver:857 : registering remote as secret driver 1
06:34:31.866: debug : virRegisterNWFilterDriver:888 : registering remote as network filter driver 1
06:34:31.866: debug : virConnectOpenAuth:1498 : name=(null), auth=0x7f98b32d5460, flags=0
06:34:31.866: debug : do_open:1206 : no name, allowing driver auto-select
06:34:31.866: debug : do_open:1243 : trying driver 0 (Test) ...
06:34:31.866: debug : do_open:1249 : driver 0 Test returned DECLINED
06:34:31.866: debug : do_open:1243 : trying driver 1 (Xen) ...
06:34:31.866: debug : do_open:1249 : driver 1 Xen returned DECLINED
06:34:31.866: debug : do_open:1243 : trying driver 2 (OPENVZ) ...
06:34:31.866: debug : do_open:1249 : driver 2 OPENVZ returned DECLINED
06:34:31.866: debug : do_open:1243 : trying driver 3 (VBOX) ...
06:34:31.866: debug : do_open:1249 : driver 3 VBOX returned DECLINED
06:34:31.866: debug : do_open:1243 : trying driver 4 (remote) ...
06:34:31.866: debug : remoteOpen:1120 : Auto-probe remote URI
06:34:31.866: debug : doRemoteOpen:564 : proceeding with name = 
06:34:31.866: debug : remoteIO:9886 : Do proc=66 serial=0 length=28 wait=(nil)
06:34:31.866: debug : remoteIO:9961 : We have the buck 66 0x7f98b077b010 0x7f98b077b010
<network>
06:34:31.867: debug : remoteIODecodeMessageLength:9314 : Got length, now need 64 total (60 more)
06:34:31.867: debug : remoteIOEventLoop:9812 : Giving up the buck 66 0x7f98b077b010 (nil)
06:34:31.867: debug : remoteIO:9990 : All done with our call 66 (nil) 0x7f98b077b010
06:34:31.867: debug : remoteIO:9886 : Do proc=1 serial=1 length=40 wait=(nil)
06:34:31.867: debug : remoteIO:9961 : We have the buck 1 0x181c920 0x181c920
06:34:31.868: debug : remoteIODecodeMessageLength:9314 : Got length, now need 56 total (52 more)
06:34:31.868: debug : remoteIOEventLoop:9812 : Giving up the buck 1 0x181c920 (nil)
06:34:31.868: debug : remoteIO:9990 : All done with our call 1 (nil) 0x181c920
06:34:31.868: debug : remoteIO:9886 : Do proc=110 serial=2 length=28 wait=(nil)
06:34:31.868: debug : remoteIO:9961 : We have the buck 110 0x181c920 0x181c920
06:34:31.869: debug : remoteIODecodeMessageLength:9314 : Got length, now need 76 total (72 more)
06:34:31.869: debug : remoteIOEventLoop:9812 : Giving up the buck 110 0x181c920 (nil)
06:34:31.869: debug : remoteIO:9990 : All done with our call 110 (nil) 0x181c920
06:34:31.869: debug : doRemoteOpen:922 : Auto-probed URI is qemu:///system
06:34:31.869: debug : doRemoteOpen:941 : Adding Handler for remote events
06:34:31.869: debug : doRemoteOpen:948 : virEventAddHandle failed: No addHandleImpl defined. continuing without events.
06:34:31.869: debug : do_open:1249 : driver 4 remote returned SUCCESS
06:34:31.869: debug : do_open:1269 : network driver 0 Test returned DECLINED
06:34:31.869: debug : do_open:1269 : network driver 1 VBOX returned DECLINED
06:34:31.869: debug : do_open:1269 : network driver 2 remote returned SUCCESS
06:34:31.869: debug : do_open:1288 : interface driver 0 Test returned DECLINED
06:34:31.869: debug : do_open:1288 : interface driver 1 remote returned SUCCESS
06:34:31.869: debug : do_open:1308 : storage driver 0 Test returned DECLINED
06:34:31.869: debug : do_open:1308 : storage driver 1 VBOX returned DECLINED
06:34:31.869: debug : do_open:1308 : storage driver 2 remote returned SUCCESS
06:34:31.869: debug : do_open:1328 : node driver 0 Test returned DECLINED
06:34:31.869: debug : do_open:1328 : node driver 1 remote returned SUCCESS
06:34:31.869: debug : do_open:1355 : secret driver 0 Test returned DECLINED
06:34:31.869: debug : do_open:1355 : secret driver 1 remote returned SUCCESS
06:34:31.869: debug : do_open:1375 : nwfilter driver 0 Test returned DECLINED
06:34:31.869: debug : do_open:1375 : nwfilter driver 1 remote returned SUCCESS
Welcome to virsh, the virtualization interactive terminal.

Type:  'help' for help with commands
       'quit' to quit

virsh # net-edit default
06:34:46.265: debug : virNetworkLookupByName:5885 : conn=0x1817060, name=default
06:34:46.266: debug : remoteIO:9886 : Do proc=46 serial=3 length=40 wait=(nil)
06:34:46.266: debug : remoteIO:9961 : We have the buck 46 0x183fcf0 0x183fcf0
06:34:46.266: debug : remoteIODecodeMessageLength:9314 : Got length, now need 84 total (80 more)
06:34:46.266: debug : remoteIOEventLoop:9812 : Giving up the buck 46 0x183fcf0 (nil)
06:34:46.266: debug : remoteIO:9990 : All done with our call 46 (nil) 0x183fcf0
06:34:46.266: debug : virNetworkGetXMLDesc:6390 : network=0x1836610, flags=0
06:34:46.266: debug : remoteIO:9886 : Do proc=43 serial=4 length=60 wait=(nil)
06:34:46.266: debug : remoteIO:9961 : We have the buck 43 0x183fcf0 0x183fcf0
06:34:46.267: debug : remoteIODecodeMessageLength:9314 : Got length, now need 372 total (368 more)
06:34:46.267: debug : remoteIOEventLoop:9812 : Giving up the buck 43 0x183fcf0 (nil)
06:34:46.267: debug : remoteIO:9990 : All done with our call 43 (nil) 0x183fcf0
06:35:28.225: debug : virNetworkGetXMLDesc:6390 : network=0x1836610, flags=0
06:35:28.225: debug : remoteIO:9886 : Do proc=43 serial=5 length=60 wait=(nil)
06:35:28.225: debug : remoteIO:9961 : We have the buck 43 0x187ff70 0x187ff70
06:35:28.225: debug : remoteIODecodeMessageLength:9314 : Got length, now need 372 total (368 more)
06:35:28.225: debug : remoteIOEventLoop:9812 : Giving up the buck 43 0x187ff70 (nil)
06:35:28.225: debug : remoteIO:9990 : All done with our call 43 (nil) 0x187ff70
06:35:28.225: debug : virNetworkFree:6229 : network=0x1836610
06:35:28.225: debug : virUnrefNetwork:601 : unref network 0x1836610 default 1
06:35:28.225: debug : virReleaseNetwork:557 : release network 0x1836610 default 445a3551-a33c-7ba1-6228-098e7d191ec3
06:35:28.226: debug : virReleaseNetwork:571 : unref connection 0x1817060 2
06:35:28.226: debug : virNetworkDefineXML:6054 : conn=0x1817060, xml=<network>
  <name>default</name>
  <uuid>445a3551-a33c-7ba1-6228-098e7d191ec3</uuid>
  <forward mode='nat'/>
  <bridge name='virbr0' stp='on' delay='0' />
  <domain name='my.private.domain.example' />           # <-- added this
  <ip address='192.168.122.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.122.2' end='192.168.122.254' />
    </dhcp>
  </ip>
</network>

06:35:28.226: debug : remoteIO:9886 : Do proc=41 serial=6 length=380 wait=(nil)
06:35:28.226: debug : remoteIO:9961 : We have the buck 41 0x187ff70 0x187ff70
06:35:28.227: debug : remoteIODecodeMessageLength:9314 : Got length, now need 84 total (80 more)
06:35:28.227: debug : remoteIOEventLoop:9812 : Giving up the buck 41 0x187ff70 (nil)
06:35:28.227: debug : remoteIO:9990 : All done with our call 41 (nil) 0x187ff70
06:35:28.227: debug : virNetworkGetName:6289 : network=0x1842d10
Network default XML configuration edited.
06:35:28.227: debug : virNetworkFree:6229 : network=0x1842d10
06:35:28.227: debug : virUnrefNetwork:601 : unref network 0x1842d10 default 1
06:35:28.227: debug : virReleaseNetwork:557 : release network 0x1842d10 default 445a3551-a33c-7ba1-6228-098e7d191ec3
06:35:28.227: debug : virReleaseNetwork:571 : unref connection 0x1817060 2

virsh # net-dumpxml default
06:36:37.105: debug : virNetworkLookupByName:5885 : conn=0x1817060, name=default
06:36:37.106: debug : remoteIO:9886 : Do proc=46 serial=7 length=40 wait=(nil)
06:36:37.106: debug : remoteIO:9961 : We have the buck 46 0x183fcf0 0x183fcf0
06:36:37.106: debug : remoteIODecodeMessageLength:9314 : Got length, now need 84 total (80 more)
06:36:37.106: debug : remoteIOEventLoop:9812 : Giving up the buck 46 0x183fcf0 (nil)
06:36:37.106: debug : remoteIO:9990 : All done with our call 46 (nil) 0x183fcf0
06:36:37.106: debug : virNetworkGetXMLDesc:6390 : network=0x1836740, flags=0
06:36:37.106: debug : remoteIO:9886 : Do proc=43 serial=8 length=60 wait=(nil)
06:36:37.106: debug : remoteIO:9961 : We have the buck 43 0x183fcf0 0x183fcf0
06:36:37.107: debug : remoteIODecodeMessageLength:9314 : Got length, now need 372 total (368 more)
06:36:37.107: debug : remoteIOEventLoop:9812 : Giving up the buck 43 0x183fcf0 (nil)
06:36:37.107: debug : remoteIO:9990 : All done with our call 43 (nil) 0x183fcf0
<network>
  <name>default</name>
  <uuid>445a3551-a33c-7ba1-6228-098e7d191ec3</uuid>
  <forward mode='nat'/>
  <bridge name='virbr0' stp='on' delay='0' />
  # <-- my edit is gone!
  <ip address='192.168.122.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.122.2' end='192.168.122.254' />
    </dhcp>
  </ip>
</network>
06:36:37.107: debug : virNetworkFree:6229 : network=0x1836740
06:36:37.107: debug : virUnrefNetwork:601 : unref network 0x1836740 default 1
06:36:37.107: debug : virReleaseNetwork:557 : release network 0x1836740 default 445a3551-a33c-7ba1-6228-098e7d191ec3
06:36:37.107: debug : virReleaseNetwork:571 : unref connection 0x1817060 2

virsh # exit


06:37:01.789: debug : virConnectClose:1524 : conn=0x1817060
06:37:01.789: debug : virUnrefConnect:294 : unref connection 0x1817060 1
06:37:01.790: debug : remoteIO:9886 : Do proc=2 serial=9 length=28 wait=(nil)
06:37:01.790: debug : remoteIO:9961 : We have the buck 2 0x183fcf0 0x183fcf0
06:37:01.790: debug : remoteIODecodeMessageLength:9314 : Got length, now need 56 total (52 more)
06:37:01.790: debug : remoteIOEventLoop:9812 : Giving up the buck 2 0x183fcf0 (nil)
06:37:01.790: debug : remoteIO:9990 : All done with our call 2 (nil) 0x183fcf0
06:37:01.790: debug : virReleaseConnect:249 : release connection 0x1817060
$ ps aux | grep dnsmasq
dnsmasq   1344  0.0  0.0  22752   880 ?        S    06:24   0:00 /usr/sbin/dnsmasq -x /var/run/dnsmasq/dnsmasq.pid -u dnsmasq -r /var/run/dnsmasq/resolv.conf -7 /etc/dnsmasq.d,.dpkg-dist,.dpkg-old,.dpkg-new
nobody    1762  0.0  0.0  21264   884 ?        S    06:24   0:00 dnsmasq --strict-order --bind-interfaces --pid-file=/var/run/libvirt/network/default.pid --conf-file=  --listen-address 192.168.122.1 --except-interface lo --dhcp-range 192.168.122.2,192.168.122.254 --dhcp-lease-max=253
pancho    2354  0.0  0.0   7548   852 pts/0    S+   06:37   0:00 grep dnsmasq
$ 

>>> END-OF-DUMP <<<

As you can see, the private dnsmasq is hence not called with the
--domain parameter.

Tried also to edit directly the /etc/libvirt/qemu/network/default.xml,
and reboot the system.  No effect.


The result is that the private dnsmasq is able to resolv the host names
of the VMs as if they were top level domains:

$ dig @192.168.122.1 debianvm

; <<>> DiG 9.7.1-P2 <<>> @192.168.122.1 debianvm
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 43919
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;debianvm.                IN  A

;; ANSWER SECTION:
debianvm.         0   IN  A   192.168.122.95

;; Query time: 0 msec
;; SERVER: 192.168.122.1#53(192.168.122.1)
;; WHEN: Fri Nov 26 07:02:58 2010
;; MSG SIZE  rcvd: 40

$ 

>>> END-OF-DUMP <<<

This prevents the system dnsmasq from resolving correctly.


N.B.: Tried this on sid and a freshly installed squeeze, same
libvirt-bin version.

Maybe the bug should be reported against libvirt0?

Thanks!

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.34.1-macmini-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages libvirt-bin depends on:
ii  adduser                   3.112+nmu2     add and remove users and groups
ii  libavahi-client3          0.6.27-3       Avahi client library
ii  libavahi-common3          0.6.27-3       Avahi common library
ii  libblkid1                 2.17.2-3.3     block device id library
ii  libc6                     2.11.2-7       Embedded GNU C Library: Shared lib
ii  libcap-ng0                0.6.4-1        An alternate posix capabilities li
ii  libdevmapper1.02.1        2:1.02.48-4    The Linux Kernel Device Mapper use
ii  libgcrypt11               1.4.5-2        LGPL Crypto library - runtime libr
ii  libgnutls26               2.8.6-1        the GNU TLS library - runtime libr
ii  libnl1                    1.1-6          library for dealing with netlink s
ii  libparted0debian1         2.3-4          The GNU Parted disk partitioning s
ii  libpciaccess0             0.12.0-1       Generic PCI access library for X
ii  libreadline6              6.1-3          GNU readline and history libraries
ii  libsasl2-2                2.1.23.dfsg1-6 Cyrus SASL - authentication abstra
ii  libudev0                  164-2          libudev shared library
ii  libuuid1                  2.17.2-3.3     Universally Unique ID library
ii  libvirt0                  0.8.3-4        library for interfacing with diffe
ii  libxenstore3.0            4.0.1-1        Xenstore communications library fo
ii  libxml2                   2.7.8.dfsg-1   GNOME XML library
ii  logrotate                 3.7.8-6        Log rotation utility

Versions of packages libvirt-bin recommends:
ii  bridge-utils              1.4-5          Utilities for configuring the Linu
ii  dnsmasq-base              2.55-2         A small caching DNS proxy and DHCP
pn  ebtables                  <none>         (no description available)
ii  gawk                      1:3.1.7.dfsg-5 GNU awk, a pattern scanning and pr
ii  iptables                  1.4.10-1       administration tools for packet fi
ii  libxml2-utils             2.7.8.dfsg-1   XML utilities
ii  netcat-openbsd            1.89-4         TCP/IP swiss army knife
ii  qemu                      0.12.5+dfsg-2  fast processor emulator
ii  qemu-kvm                  0.12.5+dfsg-5  Full virtualization on x86 hardwar

Versions of packages libvirt-bin suggests:
ii  policykit-1                   0.96-4     framework for managing administrat

-- no debconf information





More information about the Pkg-libvirt-maintainers mailing list