Merge "dhcp: Default to using local DNS resolution"

This commit is contained in:
Jenkins 2016-01-03 13:34:30 +00:00 committed by Gerrit Code Review
commit 0c07378509
4 changed files with 32 additions and 2 deletions

View File

@ -85,6 +85,13 @@ DNSMASQ_OPTS = [
"The log contains DHCP and DNS log information and "
"is useful for debugging issues with either DHCP or "
"DNS. If this section is null, disable dnsmasq log.")),
cfg.BoolOpt('dnsmasq_local_resolv', default=True,
help=_("Enables the dnsmasq service to provide name "
"resolution for instances via DNS resolvers on the "
"host running the DHCP agent. Effectively removes the "
"'--no-resolv' option from the dnsmasq process "
"arguments. Adding custom DNS resolvers to the "
"'dnsmasq_dns_servers' option disables this feature.")),
cfg.IntOpt(
'dnsmasq_lease_max',
default=(2 ** 24),

View File

@ -307,7 +307,6 @@ class Dnsmasq(DhcpLocalProcess):
cmd = [
'dnsmasq',
'--no-hosts',
'--no-resolv',
'--strict-order',
'--except-interface=lo',
'--pid-file=%s' % pid_file,
@ -384,6 +383,11 @@ class Dnsmasq(DhcpLocalProcess):
cmd.extend(
'--server=%s' % server
for server in self.conf.dnsmasq_dns_servers)
else:
# We only look at 'dnsmasq_local_resolv' if 'dnsmasq_dns_servers'
# is not set, which explicitly overrides 'dnsmasq_local_resolv'.
if not self.conf.dnsmasq_local_resolv:
cmd.append('--no-resolv')
if self.conf.dhcp_domain:
cmd.append('--domain=%s' % self.conf.dhcp_domain)

View File

@ -1000,7 +1000,6 @@ class TestDnsmasq(TestBase):
expected = [
'dnsmasq',
'--no-hosts',
'--no-resolv',
'--strict-order',
'--except-interface=lo',
'--pid-file=%s' % expected_pid_file,
@ -1129,6 +1128,12 @@ class TestDnsmasq(TestBase):
('--log-facility=%s' % dhcp_dns_log)],
network)
def test_spawn_cfg_no_local_resolv(self):
self.conf.set_override('dnsmasq_local_resolv', False)
self._test_spawn(['--conf-file=', '--no-resolv',
'--domain=openstacklocal'])
def test_spawn_max_leases_is_smaller_than_cap(self):
self._test_spawn(
['--conf-file=', '--domain=openstacklocal'],

View File

@ -0,0 +1,14 @@
---
fixes:
- Prior to Mitaka, neither specifying DNS resolvers via the
'dnsmasq_dns_servers' option in the DHCP agent configuration file nor via
neutron subnet options causes the dnsmasq service to offer the IP address
on which it resides to instances for name resolution. However, the static
dnsmasq '--no-resolv' process argument prevents name resolution via dnsmasq
leaving instances without name resolution. In Mitaka+, the
'dnsmasq_local_resolv' option in the DHCP agent configuration file enables
(by default) the dnsmasq service to provide name resolution for instances
via DNS resolvers on the host running the DHCP agent by effectively
removing the '--no-resolv' option from the dnsmasq process arguments.
Adding custom DNS resolvers to the 'dnsmasq_dns_servers' option in the DHCP
agent configuration file disables this feature.