From 77de4a3b54110c2d5b8b38efdfbeb5c35e2cb16d Mon Sep 17 00:00:00 2001 From: Aaron Rosen Date: Wed, 16 Sep 2015 15:50:21 -0700 Subject: [PATCH] ipam: Prevent none from being passed to delete Previously, it was possible for None to be passed to context.session.delete() if a port was not found (usually a result of a concurrent delete). This resulted in an UnmappedInstanceError. This is avoided now by calling query.delete() directly which does not raise any exceptions. Change-Id: I3b9f513308d90874ac8e8a7f6345697978d4920f Closes-bug: #1496554 --- neutron/db/ipam_backend_mixin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neutron/db/ipam_backend_mixin.py b/neutron/db/ipam_backend_mixin.py index d6adf01fb..3806cb040 100644 --- a/neutron/db/ipam_backend_mixin.py +++ b/neutron/db/ipam_backend_mixin.py @@ -414,7 +414,7 @@ class IpamBackendMixin(db_base_plugin_common.DbBasePluginCommon): enable_eagerloads(False).filter_by(id=port_id)) if not context.is_admin: query = query.filter_by(tenant_id=context.tenant_id) - context.session.delete(query.first()) + query.delete(synchronize_session=False) def _save_subnet(self, context, network, -- 2.45.2