[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] network: add domain to unqalified names define with <host>

On 06/24/2011 11:33 PM, Laine Stump wrote:
> If a domain name is defined for a network, add the --expand-hosts
> option to the dnsmasq commandline. This results in the domain being
> added to any hostname that is defined in a dns <host> element and
> contains no '.' characters (i.e. it is an "unqualified"
> hostname). Since PTR records are automatically created for any name
> define in <host>, the result of a PTR request will change from the
> unqualified name to the qualified name.
> This also has the same effect on any hostnames that dnsmasq reads
> from the host's /etc/hosts file. Hosts.
> I want to make sure that everyone notices that previous paragraph and
> has a chance to object if they believe this change in existing
> behavior will be detrimental. Note that guests will still be able to
> query the unqualified name, with the same results as before; it is
> only when a reverse lookup of an IP address is done that the result
> will be different, e.g. it will return "f15.example.com" instead of
> "f15".
> (In the case of guest hostnames that were learned by dnsmasq via DHCP
> requests, they were already getting the domain name added on, even
> without --expand-hosts).
> ---
>  src/network/bridge_driver.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)

I think that it is probably wiser to include this in 0.9.3 than to wait,
so that we get more experience with it prior to your pending feature of
improved network interface XML.  But I don't feel comfortable being the
only ack, so hopefully someone else speaks up as well.

> diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
> index f15a7a6..a9a0374 100644
> --- a/src/network/bridge_driver.c
> +++ b/src/network/bridge_driver.c
> @@ -614,6 +614,10 @@ networkBuildDnsmasqArgv(virNetworkObjPtr network,
>          if (ipdef->nranges || ipdef->nhosts)
>              virCommandAddArg(cmd, "--dhcp-no-override");
> +        /* add domain to any non-qualified hostnames in /etc/hosts or addn-hosts file */
> +        if (network->def->domain)
> +           virCommandAddArg(cmd, "--expand-hosts");
> +

At any rate, ACK to this code change, and I think it is reasonable
enough.  By explicitly requesting the domain in the XML, it seems like
any guest query for an unqualified name that is satisfied by the host's
lookup tables are indeed a name belonging to the fully-qualified network
tied to the guest, so returning a fully-qualified name to the guest is
reasonable (even if we previously returned an unqualified name).

Eric Blake   eblake redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]