From: Francois Eleouet Date: Mon, 2 Sep 2013 16:21:01 +0000 (+0200) Subject: Fix DHCP agent to work without extra_dhcp_opt extension X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=b63c6f9f839188ade489d77747164b0fec8ab116;p=openstack-build%2Fneutron-build.git 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 --- diff --git a/neutron/agent/linux/dhcp.py b/neutron/agent/linux/dhcp.py index 5257ca92f..86e2b5230 100644 --- a/neutron/agent/linux/dhcp.py +++ b/neutron/agent/linux/dhcp.py @@ -398,7 +398,7 @@ class Dnsmasq(DhcpLocalProcess): name = 'host-%s.%s' % (r.sub('-', alloc.ip_address), self.conf.dhcp_domain) set_tag = '' - if port.extra_dhcp_opts: + if getattr(port, 'extra_dhcp_opts', False): if self.version >= self.MINIMUM_VERSION: set_tag = 'set:' @@ -463,7 +463,7 @@ class Dnsmasq(DhcpLocalProcess): options.append(self._format_option(i, 'router')) for port in self.network.ports: - if port.extra_dhcp_opts: + if getattr(port, 'extra_dhcp_opts', False): options.extend( self._format_option(port.id, opt.opt_name, opt.opt_value) for opt in port.extra_dhcp_opts)