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

Re: [libvirt] [PATCH 1/2] v3: put dnsmasq parameters into a file instead of the command line

On 10/24/2012 07:56 AM, Gene Czarcinski wrote:
> On 10/24/2012 07:46 AM, Gene Czarcinski wrote:
>> On 10/23/2012 04:10 PM, Laine Stump wrote:
>>>> >Can you provide a bit more info as to what you would like to change
>>>> >without restarting dnsmasq.
>>> Right now, the ranges of IP addresses, the IP addresses to listen on,
>>> the domain. There may be other things in the future as
>>> virNetworkUpdate() gets fleshed out.
>> http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2012q4/006440.html
>>> The most difficult problem is that dnsmasq throws away root
>>> permissions after start-up, so re-reading the configuration is
>>> impossible if acting on the new configuration involves anything that
>>> needs root (for instance, binding sockets to ports <1024 or opening
>>> the lease file.)
>>> The philosophy is that things that would be really useful to change,
>>> without restarting dnsmasq, and certainly don't need root, are
>>> re-read on SIGHUP. That's dhcp-host information and dhcp-option
>>> information in special configuration files, /etc/hosts and
>>> /etc/ethers, and possibly /etc/resolv.conf, if it's not being polled
>>> anyway.
>>> For anything else, restarting dnsmasq is a pain-free operation
>>> anyway: there's very little state and nothing important is lost over
>>> a reboot. 
> One other thought occurs to me.
> As far as I know, the only way to get dnsmasq restarted is to do a
> net-destroy and then a net-start.  While you can do this while a
> virtual guest is on that network, the virtual guest has to be rebooted
> for it to work again.

Well, you could indirectly trigger it by adding (and then removing) a
dhcp <range> element with virsh net-update.

> Is there some way (some command) that will cause dnsmasq to be
> restarted (possibly with new parameters as it re-does its
> configuration).  If this was done, then little, except some cached
> names, would be lost).  If there is not, maybe there should be.
> However, there are likely limits such as not changing the gateway
> addresses on the interface.

I recently made a patch to check for a running dnsmasq anytime libvirt
is restarted. If it's not running, it will be restarted. If it is
running, a SIGHUP will be sent.

Aside from that, the (newly created) accepted way to change a network's
config while the network is up is to use the virNetworkUpdate API
(available via virsh net-update). It permits you to add/delete/modify
certain parts of the network config and have those changes take effect
immediately if desired. the bridge_driver backend of virNetworkUpdate
decides when it is necessary to either SIGHUP or restart dnsmasq
according to what parts of the network definition have changed.

A "live" change of the entire network definition (i.e. with
virNetworkDefine() isn't supported, and won't be - anything that you
want to be able to change while the network is up should be added to the
"sections" modifiable by virNetworkUpdate. This will permit us to easily
figure out what re-initialization is needed for a particular change
without needing to just redo everything (for example, if a dhcp static
host is added, we just need to SIGHUP dnsmasq, but if a dynamic range is
added/deleted, we need to restart dnsmasq. If an IP address is
added/removed from the bridge, we should be able to write code to simply
redo the IP addresses on the existing bridge, rather than tear it down
and build a new bridge (although that one isn't implemented yet).

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