diff options
author | Carl Baldwin <carl.baldwin@hpe.com> | 2016-06-23 15:39:47 -0600 |
---|---|---|
committer | Ken'ichi Ohmichi <ken1ohmichi@gmail.com> | 2016-08-11 23:36:29 +0000 |
commit | a587dec08cefb88c448d8cdbe741f363430c01b5 (patch) | |
tree | 12b84028697fab10baf0f9375f7cb0b8b1106982 | |
parent | 2a1833a9c19518cfe32d374abb2d7abb418fc699 (diff) | |
download | neutron-a587dec08cefb88c448d8cdbe741f363430c01b5.tar.gz |
Fix code that's trying to read from a stale DB object
Change-Id: Ib601235b56c553c29618a4dfdf0608a7b2784c6f
Closes-Bug: #1594376
(cherry picked from commit dfbe1fb7c510d556095a926fec6bfe6f4c153b47)
-rw-r--r-- | neutron/plugins/ml2/plugin.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/neutron/plugins/ml2/plugin.py b/neutron/plugins/ml2/plugin.py index 01fd1a6c6b..1e36cfe805 100644 --- a/neutron/plugins/ml2/plugin.py +++ b/neutron/plugins/ml2/plugin.py @@ -972,13 +972,16 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2, for ip in a.port.fixed_ips if ip.subnet_id != id]}} try: - self.update_port(context, a.port_id, data) + # NOTE Don't inline port_id; needed for PortNotFound. + port_id = a.port_id + self.update_port(context, port_id, data) except exc.PortNotFound: - LOG.debug("Port %s deleted concurrently", a.port_id) + # NOTE Attempting to access a.port_id here is an error. + LOG.debug("Port %s deleted concurrently", port_id) except Exception: with excutils.save_and_reraise_exception(): LOG.exception(_LE("Exception deleting fixed_ip " - "from port %s"), a.port_id) + "from port %s"), port_id) try: self.mechanism_manager.delete_subnet_postcommit(mech_context) |