Fix DHCP agent to work with latest dnsmasq
The latest dnsmasq no longer accepts hostnames which begin with a number. This affects Fedora 19 right now, and will mean Fedora 19 will not work with Neutron DHCP. dnsmasq should work with hostnames beginning with a number (RFC 1123 says this is valid), but until this is fixed, many users will be left unable to use Fedora 19 with Neutron. This patch adds a "host-" prefix to each hostname entry generated by the DHCP agent. This fixes the issue in Neutron. Fixes bug 1204125 Change-Id: I0e29ec033969c3fb958ed3a12b8962b73b0e3d94
This commit is contained in:
parent
1b3a505a01
commit
acebf769a4
@ -343,8 +343,8 @@ class Dnsmasq(DhcpLocalProcess):
|
||||
|
||||
for port in self.network.ports:
|
||||
for alloc in port.fixed_ips:
|
||||
name = '%s.%s' % (r.sub('-', alloc.ip_address),
|
||||
self.conf.dhcp_domain)
|
||||
name = 'host-%s.%s' % (r.sub('-', alloc.ip_address),
|
||||
self.conf.dhcp_domain)
|
||||
buf.write('%s,%s,%s\n' %
|
||||
(port.mac_address, name, alloc.ip_address))
|
||||
|
||||
|
@ -581,12 +581,14 @@ tag:tag0,option:router""".lstrip()
|
||||
|
||||
def test_reload_allocations(self):
|
||||
exp_host_name = '/dhcp/cccccccc-cccc-cccc-cccc-cccccccccccc/host'
|
||||
exp_host_data = """
|
||||
00:00:80:aa:bb:cc,192-168-0-2.openstacklocal,192.168.0.2
|
||||
00:00:f3:aa:bb:cc,fdca-3ba5-a17a-4ba3--2.openstacklocal,fdca:3ba5:a17a:4ba3::2
|
||||
00:00:0f:aa:bb:cc,192-168-0-3.openstacklocal,192.168.0.3
|
||||
00:00:0f:aa:bb:cc,fdca-3ba5-a17a-4ba3--3.openstacklocal,fdca:3ba5:a17a:4ba3::3
|
||||
""".lstrip()
|
||||
exp_host_data = ('00:00:80:aa:bb:cc,host-192-168-0-2.openstacklocal,'
|
||||
'192.168.0.2\n'
|
||||
'00:00:f3:aa:bb:cc,host-fdca-3ba5-a17a-4ba3--2.'
|
||||
'openstacklocal,fdca:3ba5:a17a:4ba3::2\n'
|
||||
'00:00:0f:aa:bb:cc,host-192-168-0-3.openstacklocal,'
|
||||
'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_data = "tag:tag0,option:router,192.168.0.1"
|
||||
fake_v6 = 'gdca:3ba5:a17a:4ba3::1'
|
||||
@ -625,12 +627,15 @@ tag:tag1,option:classless-static-route,%s,%s""".lstrip() % (fake_v6,
|
||||
|
||||
def test_reload_allocations_stale_pid(self):
|
||||
exp_host_name = '/dhcp/cccccccc-cccc-cccc-cccc-cccccccccccc/host'
|
||||
exp_host_data = """
|
||||
00:00:80:aa:bb:cc,192-168-0-2.openstacklocal,192.168.0.2
|
||||
00:00:f3:aa:bb:cc,fdca-3ba5-a17a-4ba3--2.openstacklocal,fdca:3ba5:a17a:4ba3::2
|
||||
00:00:0f:aa:bb:cc,192-168-0-3.openstacklocal,192.168.0.3
|
||||
00:00:0f:aa:bb:cc,fdca-3ba5-a17a-4ba3--3.openstacklocal,fdca:3ba5:a17a:4ba3::3
|
||||
""".lstrip()
|
||||
exp_host_data = ('00:00:80:aa:bb:cc,host-192-168-0-2.openstacklocal,'
|
||||
'192.168.0.2\n'
|
||||
'00:00:f3:aa:bb:cc,host-fdca-3ba5-a17a-4ba3--2.'
|
||||
'openstacklocal,fdca:3ba5:a17a:4ba3::2\n'
|
||||
'00:00:0f:aa:bb:cc,host-192-168-0-3.openstacklocal,'
|
||||
'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_data = "tag:tag0,option:router,192.168.0.1"
|
||||
fake_v6 = 'gdca:3ba5:a17a:4ba3::1'
|
||||
|
Loading…
Reference in New Issue
Block a user