DHCP agent fails when used with plugin that doesn't supports extra_dhcp_opt extension

Bug #1219893 reported by Francois Eleouet
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
neutron
Fix Released
High
Francois Eleouet

Bug Description

When DHCP agent is used with ML2 plugin that doesn't yet support extra_dhcp_opt extension, it fails to serve IP adresses.

Here is the log:

2013-09-02 17:51:14.232 9079 DEBUG neutron.agent.linux.dhcp [-] Unable to access /opt/stack/data/neutron/dhcp/6b7f26d9-a1a4-44f9-b63c-1001f5f0d0ad/pid _get_value_from_conf_file /opt/stack/neutron/neutron/agent/linux/dhcp.py:217
2013-09-02 17:51:14.233 9079 ERROR neutron.agent.dhcp_agent [-] Unable to enable dhcp.
2013-09-02 17:51:14.233 9079 TRACE neutron.agent.dhcp_agent Traceback (most recent call last):
2013-09-02 17:51:14.233 9079 TRACE neutron.agent.dhcp_agent File "/opt/stack/neutron/neutron/agent/dhcp_agent.py", line 126, in call_driver
2013-09-02 17:51:14.233 9079 TRACE neutron.agent.dhcp_agent getattr(driver, action)(**action_kwargs)
2013-09-02 17:51:14.233 9079 TRACE neutron.agent.dhcp_agent File "/opt/stack/neutron/neutron/agent/linux/dhcp.py", line 165, in enable
2013-09-02 17:51:14.233 9079 TRACE neutron.agent.dhcp_agent self.restart()
2013-09-02 17:51:14.233 9079 TRACE neutron.agent.dhcp_agent File "/opt/stack/neutron/neutron/agent/linux/dhcp.py", line 122, in restart
2013-09-02 17:51:14.233 9079 TRACE neutron.agent.dhcp_agent self.enable()
2013-09-02 17:51:14.233 9079 TRACE neutron.agent.dhcp_agent File "/opt/stack/neutron/neutron/agent/linux/dhcp.py", line 168, in enable
2013-09-02 17:51:14.233 9079 TRACE neutron.agent.dhcp_agent self.spawn_process()
2013-09-02 17:51:14.233 9079 TRACE neutron.agent.dhcp_agent File "/opt/stack/neutron/neutron/agent/linux/dhcp.py", line 319, in spawn_process
2013-09-02 17:51:14.233 9079 TRACE neutron.agent.dhcp_agent '--dhcp-hostsfile=%s' % self._output_hosts_file(),
2013-09-02 17:51:14.233 9079 TRACE neutron.agent.dhcp_agent File "/opt/stack/neutron/neutron/agent/linux/dhcp.py", line 401, in _output_hosts_file
2013-09-02 17:51:14.233 9079 TRACE neutron.agent.dhcp_agent if port.extra_dhcp_opts:
2013-09-02 17:51:14.233 9079 TRACE neutron.agent.dhcp_agent AttributeError: 'DictModel' object has no attribute 'extra_dhcp_opts'
2013-09-02 17:51:14.233 9079 TRACE neutron.agent.dhcp_agent

Changing "if port.extra_dhcp_opts:" to "if hasattr(port, 'extra_dhcp_opts') and port.extra_dhcp_opts:" in the following places seems to fix the issue.

https://github.com/openstack/neutron/blob/master/neutron/agent/linux/dhcp.py#L401
https://github.com/openstack/neutron/blob/master/neutron/agent/linux/dhcp.py#L466

Tags: l3-ipam-dhcp
description: updated
description: updated
tags: added: l3-ipam-dhcp
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

Fix proposed to branch: master
Review: https://review.openstack.org/44748

Changed in neutron:
assignee: nobody → Francois Eleouet (fanchon)
status: New → In Progress
Akihiro Motoki (amotoki)
Changed in neutron:
importance: Undecided → High
milestone: none → havana-3
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/44748
Committed: http://github.com/openstack/neutron/commit/b63c6f9f839188ade489d77747164b0fec8ab116
Submitter: Jenkins
Branch: master

commit b63c6f9f839188ade489d77747164b0fec8ab116
Author: Francois Eleouet <email address hidden>
Date: Mon Sep 2 18:21:01 2013 +0200

    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

Changed in neutron:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in neutron:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in neutron:
milestone: havana-3 → 2013.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.