Fix DHCP agent to work without extra_dhcp_opt extension
With the introduction of extra_dhcp_opt extension, DHCP agent stopped serving mac adresses when used in conjunction with a plugin that doesn't support this extension. This fixes the agent by not assuming that port dict contains extra_dhcp_opt key. Closes Bug: #1219893 Change-Id: I5bb52f3092f04c5e332b43cb3a04de05edc29cf5
This commit is contained in:
parent
4ec01c43d0
commit
9fb7420de3
@ -398,7 +398,7 @@ class Dnsmasq(DhcpLocalProcess):
|
|||||||
name = 'host-%s.%s' % (r.sub('-', alloc.ip_address),
|
name = 'host-%s.%s' % (r.sub('-', alloc.ip_address),
|
||||||
self.conf.dhcp_domain)
|
self.conf.dhcp_domain)
|
||||||
set_tag = ''
|
set_tag = ''
|
||||||
if port.extra_dhcp_opts:
|
if getattr(port, 'extra_dhcp_opts', False):
|
||||||
if self.version >= self.MINIMUM_VERSION:
|
if self.version >= self.MINIMUM_VERSION:
|
||||||
set_tag = 'set:'
|
set_tag = 'set:'
|
||||||
|
|
||||||
@ -463,7 +463,7 @@ class Dnsmasq(DhcpLocalProcess):
|
|||||||
options.append(self._format_option(i, 'router'))
|
options.append(self._format_option(i, 'router'))
|
||||||
|
|
||||||
for port in self.network.ports:
|
for port in self.network.ports:
|
||||||
if port.extra_dhcp_opts:
|
if getattr(port, 'extra_dhcp_opts', False):
|
||||||
options.extend(
|
options.extend(
|
||||||
self._format_option(port.id, opt.opt_name, opt.opt_value)
|
self._format_option(port.id, opt.opt_name, opt.opt_value)
|
||||||
for opt in port.extra_dhcp_opts)
|
for opt in port.extra_dhcp_opts)
|
||||||
|
Loading…
Reference in New Issue
Block a user