Merge "Disable dhcp_domain distribution when dhcp_domain is empty"

This commit is contained in:
Jenkins 2013-01-30 07:59:09 +00:00 committed by Gerrit Code Review
commit 68582ecfde
2 changed files with 15 additions and 9 deletions

View File

@ -222,9 +222,8 @@ class Dnsmasq(DhcpLocalProcess):
'--bind-interfaces', '--bind-interfaces',
'--interface=%s' % self.interface_name, '--interface=%s' % self.interface_name,
'--except-interface=lo', '--except-interface=lo',
'--domain=%s' % self.conf.dhcp_domain, '--pid-file=%s' % self.get_conf_file_name(
'--pid-file=%s' % self.get_conf_file_name('pid', 'pid', ensure_conf_dir=True),
ensure_conf_dir=True),
#TODO (mark): calculate value from cidr (defaults to 150) #TODO (mark): calculate value from cidr (defaults to 150)
#'--dhcp-lease-max=%s' % ?, #'--dhcp-lease-max=%s' % ?,
'--dhcp-hostsfile=%s' % self._output_hosts_file(), '--dhcp-hostsfile=%s' % self._output_hosts_file(),
@ -253,6 +252,9 @@ class Dnsmasq(DhcpLocalProcess):
if self.conf.dnsmasq_dns_server: if self.conf.dnsmasq_dns_server:
cmd.append('--server=%s' % self.conf.dnsmasq_dns_server) cmd.append('--server=%s' % self.conf.dnsmasq_dns_server)
if self.conf.dhcp_domain:
cmd.append('--domain=%s' % self.conf.dhcp_domain)
if self.namespace: if self.namespace:
ip_wrapper = ip_lib.IPWrapper(self.root_helper, self.namespace) ip_wrapper = ip_lib.IPWrapper(self.root_helper, self.namespace)
ip_wrapper.netns.execute(cmd, addl_env=env) ip_wrapper.netns.execute(cmd, addl_env=env)

View File

@ -425,7 +425,6 @@ class TestDnsmasq(TestBase):
'--bind-interfaces', '--bind-interfaces',
'--interface=tap0', '--interface=tap0',
'--except-interface=lo', '--except-interface=lo',
'--domain=openstacklocal',
'--pid-file=/dhcp/cccccccc-cccc-cccc-cccc-cccccccccccc/pid', '--pid-file=/dhcp/cccccccc-cccc-cccc-cccc-cccccccccccc/pid',
'--dhcp-hostsfile=/dhcp/cccccccc-cccc-cccc-cccc-cccccccccccc/host', '--dhcp-hostsfile=/dhcp/cccccccc-cccc-cccc-cccc-cccccccccccc/host',
'--dhcp-optsfile=/dhcp/cccccccc-cccc-cccc-cccc-cccccccccccc/opts', '--dhcp-optsfile=/dhcp/cccccccc-cccc-cccc-cccc-cccccccccccc/opts',
@ -433,8 +432,7 @@ class TestDnsmasq(TestBase):
'dnsmasq-lease-update'), 'dnsmasq-lease-update'),
'--leasefile-ro', '--leasefile-ro',
'--dhcp-range=set:tag0,192.168.0.0,static,120s', '--dhcp-range=set:tag0,192.168.0.0,static,120s',
'--dhcp-range=set:tag1,fdca:3ba5:a17a:4ba3::,static,120s', '--dhcp-range=set:tag1,fdca:3ba5:a17a:4ba3::,static,120s']
]
expected.extend(extra_options) expected.extend(extra_options)
self.execute.return_value = ('', '') self.execute.return_value = ('', '')
@ -465,15 +463,21 @@ class TestDnsmasq(TestBase):
check_exit_code=True) check_exit_code=True)
def test_spawn(self): def test_spawn(self):
self._test_spawn(['--conf-file=']) self._test_spawn(['--conf-file=', '--domain=openstacklocal'])
def test_spawn_cfg_config_file(self): def test_spawn_cfg_config_file(self):
self.conf.set_override('dnsmasq_config_file', '/foo') self.conf.set_override('dnsmasq_config_file', '/foo')
self._test_spawn(['--conf-file=/foo']) self._test_spawn(['--conf-file=/foo', '--domain=openstacklocal'])
def test_spawn_no_dhcp_domain(self):
self.conf.set_override('dhcp_domain', '')
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_server', '8.8.8.8')
self._test_spawn(['--conf-file=', '--server=8.8.8.8']) self._test_spawn(['--conf-file=',
'--server=8.8.8.8',
'--domain=openstacklocal'])
def test_output_opts_file(self): def test_output_opts_file(self):
fake_v6 = 'gdca:3ba5:a17a:4ba3::1' fake_v6 = 'gdca:3ba5:a17a:4ba3::1'