Comment 0 for bug 1219893

Revision history for this message
Francois Eleouet (fanchon) wrote :

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