Fix router delete w/SNAT in non-admin projects

Deleting a router or just clearing the gateway in a non-admin project
fails when the external network has SNAT subnets. This patch fixes
that issue.

Change-Id: Ic75b2acc975ab9ba529d539a0abad189430ed737
Closes-Bug: 1709615
This commit is contained in:
Thomas Bachman 2017-08-09 12:31:42 +00:00 committed by Thomas Bachman
parent 6687c7036b
commit 574070fae6
1 changed files with 2 additions and 1 deletions

View File

@ -2198,6 +2198,7 @@ class ApicMechanismDriver(api_plus.MechanismDriver,
def _delete_snat_ip_ports_if_reqd(self, plugin_context,
ext_network_id, exclude_router_id):
e_context = plugin_context.elevated()
session = plugin_context.session
# if there are no routers uplinked to the external network,
# then delete any ports allocated for SNAT IP
@ -2214,7 +2215,7 @@ class ApicMechanismDriver(api_plus.MechanismDriver,
.all())
for p in snat_ports:
try:
self.plugin.delete_port(plugin_context, p[0])
self.plugin.delete_port(e_context, p[0])
except n_exceptions.NeutronException as ne:
LOG.warning(_LW('Failed to delete SNAT port %(port)s: '
'%(ex)s'),