NSX|V3: Enhance add router interface failure handle

Whatever exception we got when adding router interface, we would try to
rollback including removing router interface in case of second
add-router-interface try failed.

Co-Authored-By: linb <linb@vmware.com>

Change-Id: Icd434cb0be5d4150ab381d38916df02084a94f58
This commit is contained in:
Gary Kotton 2016-08-24 05:36:39 -07:00
parent 8ae556751b
commit d43f060b19

View File

@ -2477,8 +2477,11 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
# its DHCP port), by creating it if needed.
nsx_rpc.handle_router_metadata_access(self, context, router_id,
interface=info)
except nsx_lib_exc.ManagerError:
except Exception:
with excutils.save_and_reraise_exception():
LOG.error(_LE("Neutron failed to add_router_interface on "
"router %s, and would try to rollback."),
router_id)
self.remove_router_interface(
context, router_id, interface_info)
return info