mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-28 00:25:23 +00:00
874a336108
This fixes the problem reported in:
https://bugzilla.redhat.com/show_bug.cgi?id=868389
Previously, the dnsmasq hosts file (used for static dhcp entries, and
addnhosts file (used for additional dns host entries) were only
created/referenced on the dnsmasq commandline if there was something
to put in them at the time the network was started. Once we can update
a network definition while it's active (which is now possible with
virNetworkUpdate), this is no longer a valid strategy - if there were
0 dhcp static hosts (resulting in no reference to the hosts file on the
commandline), then one was later added, the commandline wouldn't have
linked dnsmasq up to the file, so even though we create it, dnsmasq
doesn't pay any attention.
The solution is to just always create these files and reference them
on the dnsmasq commandline (almost always, anyway). That way dnsmasq
can notice when a new entry is added at runtime (a SIGHUP is sent to
dnsmasq by virNetworkUdpate whenever a host entry is added or removed)
The exception to this is that the dhcp static hosts file isn't created
if there are no lease ranges *and* no static hosts. This is because in
this case dnsmasq won't be setup to listen for dhcp requests anyway -
in that case, if the count of dhcp hosts goes from 0 to 1, dnsmasq
will need to be restarted anyway (to get it listening on the dhcp
port). Likewise, if the dhcp hosts count goes from 1 to 0 (and there
are no dhcp ranges) we need to restart dnsmasq so that it will stop
listening on port 67. These special situations are handled in the
bridge driver's networkUpdate() by checking for ((bool)
nranges||nhosts) both before and after the update, and triggering a
dnsmasq restart if the before and after don't match.
(cherry picked from commit
|
||
---|---|---|
.. | ||
isolated-network.argv | ||
isolated-network.xml | ||
nat-network-dns-hosts.argv | ||
nat-network-dns-hosts.xml | ||
nat-network-dns-srv-record-minimal.argv | ||
nat-network-dns-srv-record-minimal.xml | ||
nat-network-dns-srv-record.argv | ||
nat-network-dns-srv-record.xml | ||
nat-network-dns-txt-record.argv | ||
nat-network-dns-txt-record.xml | ||
nat-network.argv | ||
nat-network.xml | ||
netboot-network.argv | ||
netboot-network.xml | ||
netboot-proxy-network.argv | ||
netboot-proxy-network.xml | ||
routed-network.argv | ||
routed-network.xml |