_get_filterid_for_ip can generate an UnboundLocalError

Bug #1809497 reported by Brian Haley
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
High
Slawek Kaplonski

Bug Description

After fixing a bug in the L3 extension API, https://review.openstack.org/#/c/626401/ - the l3-agent is getting a traceback in the QoS code running the dvr multinode scenario job.

neutron-l3-agent[14973]: ERROR neutron.agent.l3.agent [-] Failed to process compatible router: 7461a0e1-508c-4ff2-a559-6cc89a128ea5: UnboundLocalError: local variable 'filter_id' referenced before assignment
neutron-l3-agent[14973]: ERROR neutron.agent.l3.agent Traceback (most recent call last):
neutron-l3-agent[14973]: ERROR neutron.agent.l3.agent File "/opt/stack/neutron/neutron/agent/l3/agent.py", line 628, in _process_routers_if_compatible
neutron-l3-agent[14973]: ERROR neutron.agent.l3.agent self._process_router_if_compatible(router)
neutron-l3-agent[14973]: ERROR neutron.agent.l3.agent File "/opt/stack/neutron/neutron/agent/l3/agent.py", line 504, in _process_router_if_compatible
neutron-l3-agent[14973]: ERROR neutron.agent.l3.agent self._process_updated_router(router)
neutron-l3-agent[14973]: ERROR neutron.agent.l3.agent File "/opt/stack/neutron/neutron/agent/l3/agent.py", line 529, in _process_updated_router
neutron-l3-agent[14973]: ERROR neutron.agent.l3.agent self.l3_ext_manager.update_router(self.context, router)
neutron-l3-agent[14973]: ERROR neutron.agent.l3.agent File "/opt/stack/neutron/neutron/agent/l3/l3_agent_extensions_manager.py", line 54, in update_router
neutron-l3-agent[14973]: ERROR neutron.agent.l3.agent extension.obj.update_router(context, data)
neutron-l3-agent[14973]: ERROR neutron.agent.l3.agent File "/usr/local/lib/python3.6/dist-packages/oslo_concurrency/lockutils.py", line 328, in inner
neutron-l3-agent[14973]: ERROR neutron.agent.l3.agent return f(*args, **kwargs)
neutron-l3-agent[14973]: ERROR neutron.agent.l3.agent File "/opt/stack/neutron/neutron/agent/l3/extensions/qos/fip.py", line 292, in update_router
neutron-l3-agent[14973]: ERROR neutron.agent.l3.agent self.process_floating_ip_addresses(context, router_info)
neutron-l3-agent[14973]: ERROR neutron.agent.l3.agent File "/opt/stack/neutron/neutron/agent/l3/extensions/qos/fip.py", line 277, in process_floating_ip_addresses
neutron-l3-agent[14973]: ERROR neutron.agent.l3.agent self._remove_fip_rate_limit(device, fip)
neutron-l3-agent[14973]: ERROR neutron.agent.l3.agent File "/opt/stack/neutron/neutron/agent/l3/extensions/qos/fip.py", line 164, in _remove_fip_rate_limit
neutron-l3-agent[14973]: ERROR neutron.agent.l3.agent tc_wrapper.clear_ip_rate_limit(direction, fip_ip)
neutron-l3-agent[14973]: ERROR neutron.agent.l3.agent File "/opt/stack/neutron/neutron/agent/linux/l3_tc_lib.py", line 188, in clear_ip_rate_limit
neutron-l3-agent[14973]: ERROR neutron.agent.l3.agent filter_id = self._get_filterid_for_ip(qdisc_id, ip)
neutron-l3-agent[14973]: ERROR neutron.agent.l3.agent File "/opt/stack/neutron/neutron/agent/linux/l3_tc_lib.py", line 82, in _get_filterid_for_ip
neutron-l3-agent[14973]: ERROR neutron.agent.l3.agent filterids_for_ip.append(filter_id)
neutron-l3-agent[14973]: ERROR neutron.agent.l3.agent UnboundLocalError: local variable 'filter_id' referenced before assignment
neutron-l3-agent[14973]: ERROR neutron.agent.l3.agent

From this log file:

http://logs.openstack.org/01/626401/1/check/neutron-tempest-plugin-dvr-multinode-scenario/a7bcbe2/controller/logs/screen-q-l3.txt.gz?level=WARNING#_Dec_19_23_26_00_169583

The loop in _get_filterid_for_ip() doesn't look to protect against this case, we'd need to capture the output to see why it's failing.

Hongbin Lu (hongbin.lu)
Changed in neutron:
status: New → Confirmed
Revision history for this message
Slawek Kaplonski (slaweq) wrote :

Patch is proposed for this one: https://review.openstack.org/#/c/630773/

Changed in neutron:
assignee: nobody → Slawek Kaplonski (slaweq)
Changed in neutron:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/630773
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=e788d294584add2407f601a46f90b08082cccc5f
Submitter: Zuul
Branch: master

commit e788d294584add2407f601a46f90b08082cccc5f
Author: Slawek Kaplonski <email address hidden>
Date: Mon Jan 14 22:29:25 2019 +0100

    Support iproute2 4.15 in l3_tc_lib

    In version 4.15 of iproute2 there was added support
    for chain index in tc_filter [1].
    Such version is available e.g. in Ubuntu 18.04 and it
    has to be supported in l3_tc_lib regex to match
    properly output of "tc filter" command.

    [1] https://lwn.net/Articles/745643/

    Closes-bug: #1809497
    Change-Id: Id4066b5cff933ccd0dd3c751bf67b5d58af662d1

Changed in neutron:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 14.0.0.0b2

This issue was fixed in the openstack/neutron 14.0.0.0b2 development milestone.

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

Fix proposed to branch: stable/rocky
Review: https://review.opendev.org/719751

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

Fix proposed to branch: stable/queens
Review: https://review.opendev.org/719752

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

Reviewed: https://review.opendev.org/719752
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=371204bc0e614b1af07ce25696d90f817dd9f949
Submitter: Zuul
Branch: stable/queens

commit 371204bc0e614b1af07ce25696d90f817dd9f949
Author: Slawek Kaplonski <email address hidden>
Date: Mon Jan 14 22:29:25 2019 +0100

    Support iproute2 4.15 in l3_tc_lib

    In version 4.15 of iproute2 there was added support
    for chain index in tc_filter [1].
    Such version is available e.g. in Ubuntu 18.04 and it
    has to be supported in l3_tc_lib regex to match
    properly output of "tc filter" command.

    [1] https://lwn.net/Articles/745643/

    Closes-bug: #1809497
    Change-Id: Id4066b5cff933ccd0dd3c751bf67b5d58af662d1
    (cherry picked from commit e788d294584add2407f601a46f90b08082cccc5f)

tags: added: in-stable-queens
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/rocky)

Reviewed: https://review.opendev.org/719751
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=e04ed368ad975b7a39262945b8900c13b7e13807
Submitter: Zuul
Branch: stable/rocky

commit e04ed368ad975b7a39262945b8900c13b7e13807
Author: Slawek Kaplonski <email address hidden>
Date: Mon Jan 14 22:29:25 2019 +0100

    Support iproute2 4.15 in l3_tc_lib

    In version 4.15 of iproute2 there was added support
    for chain index in tc_filter [1].
    Such version is available e.g. in Ubuntu 18.04 and it
    has to be supported in l3_tc_lib regex to match
    properly output of "tc filter" command.

    [1] https://lwn.net/Articles/745643/

    Closes-bug: #1809497
    Change-Id: Id4066b5cff933ccd0dd3c751bf67b5d58af662d1
    (cherry picked from commit e788d294584add2407f601a46f90b08082cccc5f)

tags: added: in-stable-rocky
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron queens-eol

This issue was fixed in the openstack/neutron queens-eol release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron rocky-eol

This issue was fixed in the openstack/neutron rocky-eol release.

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.