It's pointless to not include default DNS resolution for Neutron.
This adds a new config option (dnsmasq_local_resolv) which defaults
to 'True' and will allow for DNS name resolution to work out of
the box. The caveat is that if the 'dnsmasq_dns_servers' is set it
will override the 'dnsmasq_local_resolv' setting, thus allowing
operators to explicitly set their own DNS servers.
DocImpact: Default to using local DNS resolution with the DHCP agent.
Change-Id: I17a884f467d307432a06f67a9dd93ed2fa6081a3
Closes-Bug: #
1466117
Signed-off-by: Kyle Mestery <mestery@mestery.com>
"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),
cmd = [
'dnsmasq',
'--no-hosts',
- '--no-resolv',
'--strict-order',
'--except-interface=lo',
'--pid-file=%s' % pid_file,
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)
expected = [
'dnsmasq',
'--no-hosts',
- '--no-resolv',
'--strict-order',
'--except-interface=lo',
'--pid-file=%s' % expected_pid_file,
('--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'],
--- /dev/null
+---
+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.