Merge "Fix code that's trying to read from a stale DB object"

This commit is contained in:
Jenkins
2016-06-28 20:12:43 +00:00
committed by Gerrit Code Review

View File

@@ -1053,13 +1053,16 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
for ip in a.port.fixed_ips for ip in a.port.fixed_ips
if ip.subnet_id != id]}} if ip.subnet_id != id]}}
try: 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: 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: except Exception:
with excutils.save_and_reraise_exception(): with excutils.save_and_reraise_exception():
LOG.exception(_LE("Exception deleting fixed_ip " LOG.exception(_LE("Exception deleting fixed_ip "
"from port %s"), a.port_id) "from port %s"), port_id)
try: try:
self.mechanism_manager.delete_subnet_postcommit(mech_context) self.mechanism_manager.delete_subnet_postcommit(mech_context)