HA router can't associate an external network without gateway ip

Bug #1515209 reported by Hong Hui Xiao
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Low
Hong Hui Xiao

Bug Description

When associate a HA router with an external network without gateway ip, I will get the following error:

2015-11-11 03:23:44.599 ERROR neutron.agent.l3.agent [-] Failed to process compatible router '8114b0c3-85e6-4b71-ab74-a0c1437882cd'
2015-11-11 03:23:44.599 TRACE neutron.agent.l3.agent Traceback (most recent call last):
2015-11-11 03:23:44.599 TRACE neutron.agent.l3.agent File "/opt/stack/neutron/neutron/agent/l3/agent.py", line 503, in _process_router_update
2015-11-11 03:23:44.599 TRACE neutron.agent.l3.agent self._process_router_if_compatible(router)
2015-11-11 03:23:44.599 TRACE neutron.agent.l3.agent File "/opt/stack/neutron/neutron/agent/l3/agent.py", line 444, in _process_router_if_compatible
2015-11-11 03:23:44.599 TRACE neutron.agent.l3.agent self._process_added_router(router)
2015-11-11 03:23:44.599 TRACE neutron.agent.l3.agent File "/opt/stack/neutron/neutron/agent/l3/agent.py", line 452, in _process_added_router
2015-11-11 03:23:44.599 TRACE neutron.agent.l3.agent ri.process(self)
2015-11-11 03:23:44.599 TRACE neutron.agent.l3.agent File "/opt/stack/neutron/neutron/agent/l3/ha_router.py", line 387, in process
2015-11-11 03:23:44.599 TRACE neutron.agent.l3.agent super(HaRouter, self).process(agent)
2015-11-11 03:23:44.599 TRACE neutron.agent.l3.agent File "/opt/stack/neutron/neutron/common/utils.py", line 366, in call
2015-11-11 03:23:44.599 TRACE neutron.agent.l3.agent self.logger(e)
2015-11-11 03:23:44.599 TRACE neutron.agent.l3.agent File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 197, in __exit__
2015-11-11 03:23:44.599 TRACE neutron.agent.l3.agent six.reraise(self.type_, self.value, self.tb)
2015-11-11 03:23:44.599 TRACE neutron.agent.l3.agent File "/opt/stack/neutron/neutron/common/utils.py", line 363, in call
2015-11-11 03:23:44.599 TRACE neutron.agent.l3.agent return func(*args, **kwargs)
2015-11-11 03:23:44.599 TRACE neutron.agent.l3.agent File "/opt/stack/neutron/neutron/agent/l3/router_info.py", line 694, in process
2015-11-11 03:23:44.599 TRACE neutron.agent.l3.agent self.process_external(agent)
2015-11-11 03:23:44.599 TRACE neutron.agent.l3.agent File "/opt/stack/neutron/neutron/agent/l3/router_info.py", line 660, in process_external
2015-11-11 03:23:44.599 TRACE neutron.agent.l3.agent self._process_external_gateway(ex_gw_port, agent.pd)
2015-11-11 03:23:44.599 TRACE neutron.agent.l3.agent File "/opt/stack/neutron/neutron/agent/l3/router_info.py", line 569, in _process_external_gateway
2015-11-11 03:23:44.599 TRACE neutron.agent.l3.agent self.external_gateway_added(ex_gw_port, interface_name)
2015-11-11 03:23:44.599 TRACE neutron.agent.l3.agent File "/opt/stack/neutron/neutron/agent/l3/ha_router.py", line 356, in external_gateway_added
2015-11-11 03:23:44.599 TRACE neutron.agent.l3.agent self._add_gateway_vip(ex_gw_port, interface_name)
2015-11-11 03:23:44.599 TRACE neutron.agent.l3.agent File "/opt/stack/neutron/neutron/agent/l3/ha_router.py", line 249, in _add_gateway_vip
2015-11-11 03:23:44.599 TRACE neutron.agent.l3.agent self._add_default_gw_virtual_route(ex_gw_port, interface_name)
2015-11-11 03:23:44.599 TRACE neutron.agent.l3.agent File "/opt/stack/neutron/neutron/agent/l3/ha_router.py", line 205, in _add_default_gw_virtual_route
2015-11-11 03:23:44.599 TRACE neutron.agent.l3.agent instance.virtual_routes.gateway_routes = default_gw_rts
2015-11-11 03:23:44.599 TRACE neutron.agent.l3.agent UnboundLocalError: local variable 'instance' referenced before assignment

For HA router, the default gw route should only be added when there is any gateway ip present.

https://github.com/openstack/neutron/blob/master/neutron/agent/l3/ha_router.py#L248

Hong Hui Xiao (xiaohhui)
Changed in neutron:
assignee: nobody → Hong Hui Xiao (xiaohhui)
tags: added: l3-ha
description: updated
Changed in neutron:
status: New → Confirmed
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/244074

Changed in neutron:
status: Confirmed → In Progress
Revision history for this message
Miguel Angel Ajo (mangelajo) wrote :

Thanks, I see you're already at it.

Could you add more details on how to reproduce it?, I guess it's just creating the external subnet without specifying the gateway_ip ?

Changed in neutron:
importance: Undecided → Low
tags: added: kilo-backport-potential liberty-backport-potential
Revision history for this message
Hong Hui Xiao (xiaohhui) wrote :

Hi, the reproduce is simple.

1) create external net,
2) then create subnet for the net. When creating the subnet, specify --no-gateway
3) set router gateway by neutron-gateway-set <HA router> <external net in 1)>

Then, you will get the error in l3-agent's log,

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/244074
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=14c09fdfc4fbda874508c170ac6a7d6ead0bfd2e
Submitter: Jenkins
Branch: master

commit 14c09fdfc4fbda874508c170ac6a7d6ead0bfd2e
Author: Hong Hui Xiao <email address hidden>
Date: Sun Nov 15 04:06:45 2015 -0500

    Don't add default route to HA router if there is no gateway ip

    When adding an external network with no gateway ip to a HA router,
    l3 agent will report exception. The exception comes from the code
    of adding default route to HA router. However, if there is no
    gateway ip in the external network, there is no need to add such
    route.

    Change-Id: I41d6a292c903758f408d3d93a64dca7adeeb5769
    Closes-Bug: #1515209

Changed in neutron:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/liberty)

Fix proposed to branch: stable/liberty
Review: https://review.openstack.org/246722

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/kilo)

Fix proposed to branch: stable/kilo
Review: https://review.openstack.org/247291

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on neutron (stable/kilo)

Change abandoned by Hong Hui Xiao (<email address hidden>) on branch: stable/kilo
Review: https://review.openstack.org/247291
Reason: I don't think kilo needs this patch, since kilo's code will not have the problem reported in bug 1515209.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/liberty)

Reviewed: https://review.openstack.org/246722
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=588e9e401d8c405c4c4fe73a0bdb7ee1f3680ee5
Submitter: Jenkins
Branch: stable/liberty

commit 588e9e401d8c405c4c4fe73a0bdb7ee1f3680ee5
Author: Hong Hui Xiao <email address hidden>
Date: Sun Nov 15 04:06:45 2015 -0500

    Don't add default route to HA router if there is no gateway ip

    When adding an external network with no gateway ip to a HA router,
    l3 agent will report exception. The exception comes from the code
    of adding default route to HA router. However, if there is no
    gateway ip in the external network, there is no need to add such
    route.

    Change-Id: I41d6a292c903758f408d3d93a64dca7adeeb5769
    Closes-Bug: #1515209
    (cherry picked from commit 14c09fdfc4fbda874508c170ac6a7d6ead0bfd2e)

tags: added: in-stable-liberty
Revision history for this message
Thierry Carrez (ttx) wrote : Fix included in openstack/neutron 8.0.0.0b1

This issue was fixed in the openstack/neutron 8.0.0.0b1 development milestone.

Changed in neutron:
status: Fix Committed → Fix Released
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/neutron 7.0.1

This issue was fixed in the openstack/neutron 7.0.1 release.

tags: removed: kilo-backport-potential liberty-backport-potential
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.