Improve router deletion logging in tempest cleanup

Improve logging in tempest cleanup when a router and
its interfaces are being deleted. The review adds a
try except block for every attempt to remove a port.
By that addition any port error will not be hidden
behind the router error the port is attached to.
It will provide more precise error logging.

Change-Id: I475deec7b29600627f68ff07c5546e55cdab100f
This commit is contained in:
Martin Kopec 2019-04-01 14:41:53 +00:00
parent fd01fe9445
commit 598b1ae854
1 changed files with 9 additions and 5 deletions

View File

@ -471,12 +471,16 @@ class NetworkRouterService(BaseNetworkService):
routers = self.list()
for router in routers:
rid = router['id']
try:
ports = [port for port
in ports_client.list_ports(device_id=rid)['ports']
if net_info.is_router_interface_port(port)]
for port in ports:
ports = [port for port
in ports_client.list_ports(device_id=rid)['ports']
if net_info.is_router_interface_port(port)]
for port in ports:
try:
client.remove_router_interface(rid, port_id=port['id'])
except Exception:
LOG.exception("Delete Router Interface exception for "
"'port %s' of 'router %s'.", port['id'], rid)
try:
client.delete_router(rid)
except Exception:
LOG.exception("Delete Router %s exception.", rid)