KeyError 'gateway_ip' in neutron/services/segments/plugin.py

Bug #1868724 reported by Harald Jensås
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
neutron
High
Brian Haley

Bug Description

    2020-03-24 00:12:05.019 35 ERROR neutron_lib.callbacks.manager [req-be6ef908-8d3c-4e20-84b5-80ef1d8ab94e 8a8ad2f8e3f7478b8ce5e84f620cb4db 255eb2ea84ed4b29a55aceffcecf2a5d - default default] Error during notification for neutron.services.segments.plugin.NovaSegmentNotifier._notify_subnet_deleted--9223372036853509478 subnet, after_delete: KeyError: 'gateway_ip'
    2020-03-24 00:12:05.019 35 ERROR neutron_lib.callbacks.manager Traceback (most recent call last):
    2020-03-24 00:12:05.019 35 ERROR neutron_lib.callbacks.manager File "/usr/lib/python2.7/site-packages/neutron_lib/callbacks/manager.py", line 197, in _notify_loop
    2020-03-24 00:12:05.019 35 ERROR neutron_lib.callbacks.manager callback(resource, event, trigger, **kwargs)
    2020-03-24 00:12:05.019 35 ERROR neutron_lib.callbacks.manager File "/usr/lib/python2.7/site-packages/neutron/services/segments/plugin.py", line 321, in _notify_subnet_deleted
    2020-03-24 00:12:05.019 35 ERROR neutron_lib.callbacks.manager total, reserved = self._calculate_inventory_total_and_reserved(subnet)
    2020-03-24 00:12:05.019 35 ERROR neutron_lib.callbacks.manager File "/usr/lib/python2.7/site-packages/neutron/services/segments/plugin.py", line 271, in _calculate_inventory_total_and_reserved
    2020-03-24 00:12:05.019 35 ERROR neutron_lib.callbacks.manager if subnet['gateway_ip']:
    2020-03-24 00:12:05.019 35 ERROR neutron_lib.callbacks.manager KeyError: 'gateway_ip'
    2020-03-24 00:12:05.019 35 ERROR neutron_lib.callbacks.manager
    2020-03-24 00:12:05.020 35 ERROR neutron_lib.callbacks.manager [req-be6ef908-8d3c-4e20-84b5-80ef1d8ab94e 8a8ad2f8e3f7478b8ce5e84f620cb4db 255eb2ea84ed4b29a55aceffcecf2a5d - default default] Error during notification for neutron.services.segments.plugin.NovaSegmentNotifier._notify_subnet_deleted--9223372036852953322 subnet, after_delete: KeyError: 'gateway_ip'
    2020-03-24 00:12:05.020 35 ERROR neutron_lib.callbacks.manager Traceback (most recent call last):
    2020-03-24 00:12:05.020 35 ERROR neutron_lib.callbacks.manager File "/usr/lib/python2.7/site-packages/neutron_lib/callbacks/manager.py", line 197, in _notify_loop
    2020-03-24 00:12:05.020 35 ERROR neutron_lib.callbacks.manager callback(resource, event, trigger, **kwargs)
    2020-03-24 00:12:05.020 35 ERROR neutron_lib.callbacks.manager File "/usr/lib/python2.7/site-packages/neutron/services/segments/plugin.py", line 321, in _notify_subnet_deleted
    2020-03-24 00:12:05.020 35 ERROR neutron_lib.callbacks.manager total, reserved = self._calculate_inventory_total_and_reserved(subnet)
    2020-03-24 00:12:05.020 35 ERROR neutron_lib.callbacks.manager File "/usr/lib/python2.7/site-packages/neutron/services/segments/plugin.py", line 271, in _calculate_inventory_total_and_reserved
    2020-03-24 00:12:05.020 35 ERROR neutron_lib.callbacks.manager if subnet['gateway_ip']:
    2020-03-24 00:12:05.020 35 ERROR neutron_lib.callbacks.manager KeyError: 'gateway_ip'
    2020-03-24 00:12:05.020 35 ERROR neutron_lib.callbacks.manager

Changed in neutron:
assignee: nobody → Brian Haley (brian-haley)
status: New → Confirmed
importance: Undecided → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

Fix proposed to branch: master
Review: https://review.opendev.org/714731

Changed in neutron:
status: Confirmed → In Progress
Revision history for this message
Rodolfo Alonso (rodolfo-alonso-hernandez) wrote :

Hello Harald:

I don't understand how this happened. "subnet" is a dict from a subnet OVO and "gateway_ip" field is defined in this OVO since 2016.

When this happened? Is it possible to have more logs? How did you delete this subnet? Using the CLI tool? Can I reproduce it?

Regards.

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

Reviewed: https://review.opendev.org/714731
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=07b015d7897d6cea48eec1fdd02c9e19d4990973
Submitter: Zuul
Branch: master

commit 07b015d7897d6cea48eec1fdd02c9e19d4990973
Author: Brian Haley <email address hidden>
Date: Tue Mar 24 14:10:38 2020 -0400

    Use dict .get() to avoid a KeyError in the segment plugin

    On subnet delete, the supplied subnet in the post hook
    could contain a subnet without certain items, leading to
    a KeyError in the segment plugin. Fix a number of these
    occurences so this cannot happen.

    Also fixed similar code in the segment tests.

    Change-Id: I645610febde446b78ed6edd868e699673648a4de
    Closes-bug: #1868724

Changed in neutron:
status: In Progress → Fix Released
tags: added: neutron-proactive-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/train)

Fix proposed to branch: stable/train
Review: https://review.opendev.org/725278

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

Reviewed: https://review.opendev.org/725278
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=b019821abd9304f4eeaea4ed3ea37de8e903eb9e
Submitter: Zuul
Branch: stable/train

commit b019821abd9304f4eeaea4ed3ea37de8e903eb9e
Author: Brian Haley <email address hidden>
Date: Tue Mar 24 14:10:38 2020 -0400

    Use dict .get() to avoid a KeyError in the segment plugin

    On subnet delete, the supplied subnet in the post hook
    could contain a subnet without certain items, leading to
    a KeyError in the segment plugin. Fix a number of these
    occurences so this cannot happen.

    Also fixed similar code in the segment tests.

    Change-Id: I645610febde446b78ed6edd868e699673648a4de
    Closes-bug: #1868724
    (cherry picked from commit 07b015d7897d6cea48eec1fdd02c9e19d4990973)

tags: added: in-stable-train
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/stein)

Fix proposed to branch: stable/stein
Review: https://review.opendev.org/749945

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/749946

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/749949

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

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

commit ce8d891c79ed18aa0f7cd353e4121b22a6395a76
Author: Brian Haley <email address hidden>
Date: Tue Mar 24 14:10:38 2020 -0400

    Use dict .get() to avoid a KeyError in the segment plugin

    On subnet delete, the supplied subnet in the post hook
    could contain a subnet without certain items, leading to
    a KeyError in the segment plugin. Fix a number of these
    occurences so this cannot happen.

    Also fixed similar code in the segment tests.

    Change-Id: I645610febde446b78ed6edd868e699673648a4de
    Closes-bug: #1868724
    (cherry picked from commit 07b015d7897d6cea48eec1fdd02c9e19d4990973)
    (cherry picked from commit b019821abd9304f4eeaea4ed3ea37de8e903eb9e)

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

Reviewed: https://review.opendev.org/749949
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=45f56356065a962c242e187c5ee6cacfa0bd89f8
Submitter: Zuul
Branch: stable/queens

commit 45f56356065a962c242e187c5ee6cacfa0bd89f8
Author: Brian Haley <email address hidden>
Date: Tue Mar 24 14:10:38 2020 -0400

    Use dict .get() to avoid a KeyError in the segment plugin

    On subnet delete, the supplied subnet in the post hook
    could contain a subnet without certain items, leading to
    a KeyError in the segment plugin. Fix a number of these
    occurences so this cannot happen.

    Also fixed similar code in the segment tests.

    Conflicts:
        neutron/services/segments/plugin.py

    Change-Id: I645610febde446b78ed6edd868e699673648a4de
    Closes-bug: #1868724
    (cherry picked from commit 07b015d7897d6cea48eec1fdd02c9e19d4990973)
    (cherry picked from commit b019821abd9304f4eeaea4ed3ea37de8e903eb9e)

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

Reviewed: https://review.opendev.org/749945
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=97f6e2569ee128f8831eba0b9272f30be39133f2
Submitter: Zuul
Branch: stable/stein

commit 97f6e2569ee128f8831eba0b9272f30be39133f2
Author: Brian Haley <email address hidden>
Date: Tue Mar 24 14:10:38 2020 -0400

    Use dict .get() to avoid a KeyError in the segment plugin

    On subnet delete, the supplied subnet in the post hook
    could contain a subnet without certain items, leading to
    a KeyError in the segment plugin. Fix a number of these
    occurences so this cannot happen.

    Also fixed similar code in the segment tests.

    Change-Id: I645610febde446b78ed6edd868e699673648a4de
    Closes-bug: #1868724
    (cherry picked from commit 07b015d7897d6cea48eec1fdd02c9e19d4990973)
    (cherry picked from commit b019821abd9304f4eeaea4ed3ea37de8e903eb9e)

tags: added: in-stable-stein
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers