Merge "Allow multiple DNS forwarders for dnsmasq"
This commit is contained in:
commit
110d379fdd
@ -62,8 +62,9 @@
|
|||||||
# Override the default dnsmasq settings with this file
|
# Override the default dnsmasq settings with this file
|
||||||
# dnsmasq_config_file =
|
# dnsmasq_config_file =
|
||||||
|
|
||||||
# Use another DNS server before any in /etc/resolv.conf.
|
# Comma-separated list of DNS servers which will be used by dnsmasq
|
||||||
# dnsmasq_dns_server =
|
# as forwarders.
|
||||||
|
# dnsmasq_dns_servers =
|
||||||
|
|
||||||
# Limit number of leases to prevent a denial-of-service.
|
# Limit number of leases to prevent a denial-of-service.
|
||||||
# dnsmasq_lease_max = 16777216
|
# dnsmasq_lease_max = 16777216
|
||||||
|
@ -50,9 +50,10 @@ OPTS = [
|
|||||||
cfg.StrOpt('dnsmasq_config_file',
|
cfg.StrOpt('dnsmasq_config_file',
|
||||||
default='',
|
default='',
|
||||||
help=_('Override the default dnsmasq settings with this file')),
|
help=_('Override the default dnsmasq settings with this file')),
|
||||||
cfg.StrOpt('dnsmasq_dns_server',
|
cfg.ListOpt('dnsmasq_dns_servers',
|
||||||
help=_('Use another DNS server before any in '
|
help=_('Comma-separated list of the DNS servers which will be '
|
||||||
'/etc/resolv.conf.')),
|
'used as forwarders.'),
|
||||||
|
deprecated_name='dnsmasq_dns_server'),
|
||||||
cfg.BoolOpt('dhcp_delete_namespaces', default=False,
|
cfg.BoolOpt('dhcp_delete_namespaces', default=False,
|
||||||
help=_("Delete namespace after removing a dhcp server.")),
|
help=_("Delete namespace after removing a dhcp server.")),
|
||||||
cfg.IntOpt(
|
cfg.IntOpt(
|
||||||
@ -361,8 +362,10 @@ class Dnsmasq(DhcpLocalProcess):
|
|||||||
min(possible_leases, self.conf.dnsmasq_lease_max))
|
min(possible_leases, self.conf.dnsmasq_lease_max))
|
||||||
|
|
||||||
cmd.append('--conf-file=%s' % self.conf.dnsmasq_config_file)
|
cmd.append('--conf-file=%s' % self.conf.dnsmasq_config_file)
|
||||||
if self.conf.dnsmasq_dns_server:
|
if self.conf.dnsmasq_dns_servers:
|
||||||
cmd.append('--server=%s' % self.conf.dnsmasq_dns_server)
|
cmd.extend(
|
||||||
|
'--server=%s' % server
|
||||||
|
for server in self.conf.dnsmasq_dns_servers)
|
||||||
|
|
||||||
if self.conf.dhcp_domain:
|
if self.conf.dhcp_domain:
|
||||||
cmd.append('--domain=%s' % self.conf.dhcp_domain)
|
cmd.append('--domain=%s' % self.conf.dhcp_domain)
|
||||||
|
@ -717,11 +717,19 @@ class TestDnsmasq(TestBase):
|
|||||||
self._test_spawn(['--conf-file='])
|
self._test_spawn(['--conf-file='])
|
||||||
|
|
||||||
def test_spawn_cfg_dns_server(self):
|
def test_spawn_cfg_dns_server(self):
|
||||||
self.conf.set_override('dnsmasq_dns_server', '8.8.8.8')
|
self.conf.set_override('dnsmasq_dns_servers', ['8.8.8.8'])
|
||||||
self._test_spawn(['--conf-file=',
|
self._test_spawn(['--conf-file=',
|
||||||
'--server=8.8.8.8',
|
'--server=8.8.8.8',
|
||||||
'--domain=openstacklocal'])
|
'--domain=openstacklocal'])
|
||||||
|
|
||||||
|
def test_spawn_cfg_multiple_dns_server(self):
|
||||||
|
self.conf.set_override('dnsmasq_dns_servers', ['8.8.8.8',
|
||||||
|
'9.9.9.9'])
|
||||||
|
self._test_spawn(['--conf-file=',
|
||||||
|
'--server=8.8.8.8',
|
||||||
|
'--server=9.9.9.9',
|
||||||
|
'--domain=openstacklocal'])
|
||||||
|
|
||||||
def test_spawn_max_leases_is_smaller_than_cap(self):
|
def test_spawn_max_leases_is_smaller_than_cap(self):
|
||||||
self._test_spawn(
|
self._test_spawn(
|
||||||
['--conf-file=', '--domain=openstacklocal'],
|
['--conf-file=', '--domain=openstacklocal'],
|
||||||
|
Loading…
Reference in New Issue
Block a user