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

[libvirt] problem trying to use net-update



On 10/24/2012 01:31 PM, Laine Stump wrote:
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).
I finally got around to testing this .... how is this suppose to work? Is this a "work in progress?"

I did not try this first but it is what seemed to work ...

I edited a network definition so that it space for a dhcp-range addition. Then, with the network not started, i used net-update to add a ip-dhcp-range and it worked (the file was updated). Edit the xml again to remove the added range, and start the network. Do the same thing again with net-update ... the file was updated and dnsmasq was restarted.

What I started out to do and what did not work was to add a dns-host definition to a network. This should not require a restart but result a [Refresh] SIGHUP of the dnsmasq process.

1. Using net-edit to add the dns-host definition [resulted in networkCreate() being executed] and then issuing SIGHUP to the process and the addnhosts file was read and things worked as I wanted them to.

2. Trying to get the same thing accomplished using net-update [dns-host] was a failure. The only thing that happened was to get the following error message: "this function is not supported by the connection driver: can't update 'dns host' section of network 'default'" where I tried a bunch of different networks. Some of them already had a dns-host definition and some did not.

Should I expect this to work?  Is this a bug?

Gene


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