Move remove_router_interface_info db call ahead of backend call

This patch moves remove_router_interface_info db call ahead of backend
call so that any validation check can be executed before calling
backend.
Fixes-Bug: #1548624

Change-Id: I34052efb5a39c40987d720720cb62c292d0b4859
This commit is contained in:
linb 2016-02-23 12:09:10 +08:00 committed by garyk
parent 905695951e
commit e4f1f85d1c

View File

@ -1459,6 +1459,8 @@ class NsxV3Plugin(addr_pair_db.AllowedAddressPairsMixin,
else:
raise l3.RouterInterfaceNotFoundForSubnet(router_id=router_id,
subnet_id=subnet_id)
info = super(NsxV3Plugin, self).remove_router_interface(
context, router_id, interface_info)
try:
# TODO(berlin): Revocate announce the subnet on tier0 if
# enable_snat is False
@ -1490,8 +1492,12 @@ class NsxV3Plugin(addr_pair_db.AllowedAddressPairsMixin,
"%(net_id)s not found at the backend"),
{'router_id': router_id,
'net_id': subnet['network_id']})
info = super(NsxV3Plugin, self).remove_router_interface(
context, router_id, interface_info)
except nsx_exc.ManagerError:
with excutils.save_and_reraise_exception():
LOG.exception(_LE("Failed to update router %(id)s at the "
"backend. The error would lead to mapping "
"inconsistency on this router!"),
{'id': router_id})
# Ensure the connection to the 'metadata access network' is removed
# (with the network) if this the last subnet on the router.
nsx_rpc.handle_router_metadata_access(self, context, router_id)