Do not attempt ext gw port reset for deleted routers

This patch prevents _nsx_delete_ext_gw_port from attempting to
operate on the external gateway port for a router which has
already been deleted from the backend.
This situation occurs since the behaviour of delete_router
has been changed by 1e00041b0bcb83175760eb6347bb3eae55649328

Closes-Bug: #1426570

Change-Id: I2029df5227e312815fa3f955bfd1bcc19c5216b5
This commit is contained in:
Salvatore Orlando 2015-02-26 14:58:45 -08:00
parent 2eb68aa2c3
commit 2f46cd7afd
1 changed files with 9 additions and 3 deletions

View File

@ -633,12 +633,18 @@ class NsxPluginV2(addr_pair_db.AllowedAddressPairsMixin,
# TODO(salvatore-orlando): Handle NSX resource
# rollback when something goes not quite as expected
try:
lr_port = self._find_router_gw_port(context, port_data)
# Delete is actually never a real delete, otherwise the NSX
# logical router will stop working
router_id = port_data['device_id']
nsx_router_id = nsx_utils.get_nsx_router_id(
context.session, self.cluster, router_id)
if not nsx_router_id:
LOG.debug("No object found on backend for router %s. This "
"that the router was already deleted and no "
"further action is needed for resetting the "
"external gateway port", router_id)
return
lr_port = self._find_router_gw_port(context, port_data)
# Delete is actually never a real delete, otherwise the NSX
# logical router will stop working
routerlib.update_router_lport(self.cluster,
nsx_router_id,
lr_port['uuid'],