]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Fix DHCP agent to work without extra_dhcp_opt extension
authorFrancois Eleouet <f.eleouet@gmail.com>
Mon, 2 Sep 2013 16:21:01 +0000 (18:21 +0200)
committerFrancois Eleouet <f.eleouet@gmail.com>
Mon, 2 Sep 2013 16:58:04 +0000 (18:58 +0200)
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

neutron/agent/linux/dhcp.py

index 5257ca92f907aab735c893fd77ea036f3a91a62f..86e2b52301fe348a20fb1b307bcbcf54d40e7dbb 100644 (file)
@@ -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)