From: Aaron Rosen Date: Wed, 16 Sep 2015 22:50:21 +0000 (-0700) Subject: ipam: Prevent none from being passed to delete X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=77de4a3b54110c2d5b8b38efdfbeb5c35e2cb16d;p=openstack-build%2Fneutron-build.git 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 --- 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,