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 protected]> 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 -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to neutron. https://bugs.launchpad.net/bugs/1868724 Title: KeyError 'gateway_ip' in neutron/services/segments/plugin.py Status in neutron: Fix Released 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 To manage notifications about this bug go to: https://bugs.launchpad.net/neutron/+bug/1868724/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : [email protected] Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp

