Merge "Fix DHCP agent to work with latest dnsmasq"

This commit is contained in:
Jenkins 2013-07-24 19:41:08 +00:00 committed by Gerrit Code Review
commit b1311a3ab8
2 changed files with 19 additions and 14 deletions

View File

@ -344,7 +344,7 @@ class Dnsmasq(DhcpLocalProcess):
for port in self.network.ports: for port in self.network.ports:
for alloc in port.fixed_ips: for alloc in port.fixed_ips:
name = '%s.%s' % (r.sub('-', alloc.ip_address), name = 'host-%s.%s' % (r.sub('-', alloc.ip_address),
self.conf.dhcp_domain) self.conf.dhcp_domain)
buf.write('%s,%s,%s\n' % buf.write('%s,%s,%s\n' %
(port.mac_address, name, alloc.ip_address)) (port.mac_address, name, alloc.ip_address))

View File

@ -587,12 +587,14 @@ tag:tag0,option:router""".lstrip()
def test_reload_allocations(self): def test_reload_allocations(self):
exp_host_name = '/dhcp/cccccccc-cccc-cccc-cccc-cccccccccccc/host' exp_host_name = '/dhcp/cccccccc-cccc-cccc-cccc-cccccccccccc/host'
exp_host_data = """ exp_host_data = ('00:00:80:aa:bb:cc,host-192-168-0-2.openstacklocal,'
00:00:80:aa:bb:cc,192-168-0-2.openstacklocal,192.168.0.2 '192.168.0.2\n'
00:00:f3:aa:bb:cc,fdca-3ba5-a17a-4ba3--2.openstacklocal,fdca:3ba5:a17a:4ba3::2 '00:00:f3:aa:bb:cc,host-fdca-3ba5-a17a-4ba3--2.'
00:00:0f:aa:bb:cc,192-168-0-3.openstacklocal,192.168.0.3 'openstacklocal,fdca:3ba5:a17a:4ba3::2\n'
00:00:0f:aa:bb:cc,fdca-3ba5-a17a-4ba3--3.openstacklocal,fdca:3ba5:a17a:4ba3::3 '00:00:0f:aa:bb:cc,host-192-168-0-3.openstacklocal,'
""".lstrip() '192.168.0.3\n'
'00:00:0f:aa:bb:cc,host-fdca-3ba5-a17a-4ba3--3.'
'openstacklocal,fdca:3ba5:a17a:4ba3::3\n').lstrip()
exp_opt_name = '/dhcp/cccccccc-cccc-cccc-cccc-cccccccccccc/opts' exp_opt_name = '/dhcp/cccccccc-cccc-cccc-cccc-cccccccccccc/opts'
exp_opt_data = "tag:tag0,option:router,192.168.0.1" exp_opt_data = "tag:tag0,option:router,192.168.0.1"
fake_v6 = 'gdca:3ba5:a17a:4ba3::1' fake_v6 = 'gdca:3ba5:a17a:4ba3::1'
@ -633,12 +635,15 @@ tag:tag1,249,%s,%s""".lstrip() % (fake_v6,
def test_reload_allocations_stale_pid(self): def test_reload_allocations_stale_pid(self):
exp_host_name = '/dhcp/cccccccc-cccc-cccc-cccc-cccccccccccc/host' exp_host_name = '/dhcp/cccccccc-cccc-cccc-cccc-cccccccccccc/host'
exp_host_data = """ exp_host_data = ('00:00:80:aa:bb:cc,host-192-168-0-2.openstacklocal,'
00:00:80:aa:bb:cc,192-168-0-2.openstacklocal,192.168.0.2 '192.168.0.2\n'
00:00:f3:aa:bb:cc,fdca-3ba5-a17a-4ba3--2.openstacklocal,fdca:3ba5:a17a:4ba3::2 '00:00:f3:aa:bb:cc,host-fdca-3ba5-a17a-4ba3--2.'
00:00:0f:aa:bb:cc,192-168-0-3.openstacklocal,192.168.0.3 'openstacklocal,fdca:3ba5:a17a:4ba3::2\n'
00:00:0f:aa:bb:cc,fdca-3ba5-a17a-4ba3--3.openstacklocal,fdca:3ba5:a17a:4ba3::3 '00:00:0f:aa:bb:cc,host-192-168-0-3.openstacklocal,'
""".lstrip() '192.168.0.3\n'
'00:00:0f:aa:bb:cc,host-fdca-3ba5-a17a-4ba3--3.'
'openstacklocal,fdca:3ba5:a17a:4ba3::3\n').lstrip()
exp_host_data.replace('\n', '')
exp_opt_name = '/dhcp/cccccccc-cccc-cccc-cccc-cccccccccccc/opts' exp_opt_name = '/dhcp/cccccccc-cccc-cccc-cccc-cccccccccccc/opts'
exp_opt_data = "tag:tag0,option:router,192.168.0.1" exp_opt_data = "tag:tag0,option:router,192.168.0.1"
fake_v6 = 'gdca:3ba5:a17a:4ba3::1' fake_v6 = 'gdca:3ba5:a17a:4ba3::1'