[L3] Add some logs for router processing

In order to dig the real action of a ResourceUpdate, add logs for:
1. add/update router
2. delete router
3. delete namespace
4. agent extension router add/delete/update actions

Change-Id: I5c0ff485cd0c966afe535f8063deca6e410e012d
Related-bug: #1881995
This commit is contained in:
LIU Yulong 2020-06-17 23:18:04 +08:00 committed by liuyulong
parent 2e403a3bfb
commit ac1597d009
3 changed files with 14 additions and 1 deletions

View File

@ -546,6 +546,8 @@ class L3NATAgent(ha.AgentMixin,
except Exception:
with excutils.save_and_reraise_exception():
self.router_info[router_id] = ri
LOG.debug("Router info %s delete action done, "
"and it was removed from cache.", router_id)
registry.notify(resources.ROUTER, events.AFTER_DELETE, self, router=ri)
@ -610,8 +612,12 @@ class L3NATAgent(ha.AgentMixin,
raise l3_exc.RouterNotCompatibleWithAgent(router_id=router['id'])
if router['id'] not in self.router_info:
LOG.debug("Router %s info not in cache, "
"will do the router add action.", router['id'])
self._process_added_router(router)
else:
LOG.debug("Router %s info in cache, "
"will do the router update action.", router['id'])
self._process_updated_router(router)
def _process_added_router(self, router):
@ -738,7 +744,7 @@ class L3NATAgent(ha.AgentMixin,
# processing queue (like events from fullsync) in order to
# prevent deleted router re-creation
rp.fetched_and_processed(update.timestamp)
LOG.info("Finished a router update for %s, update_id %s. "
LOG.info("Finished a router delete for %s, update_id %s. "
"Time elapsed: %.3f",
update.id, update.update_id,
update.time_elapsed_since_start)

View File

@ -46,6 +46,8 @@ class L3AgentExtensionsManager(agent_ext_manager.AgentExtensionsManager):
"implement method add_router",
{'name': extension.name}
)
LOG.debug("L3 agent extension(s) finished router %s "
"add action.", data['id'])
def update_router(self, context, data):
"""Notify all agent extensions to update router."""
@ -58,6 +60,8 @@ class L3AgentExtensionsManager(agent_ext_manager.AgentExtensionsManager):
"implement method update_router",
{'name': extension.name}
)
LOG.debug("L3 agent extension(s) finished router %s "
"update action.", data['id'])
def delete_router(self, context, data):
"""Notify all agent extensions to delete router."""
@ -70,6 +74,8 @@ class L3AgentExtensionsManager(agent_ext_manager.AgentExtensionsManager):
"implement method delete_router",
{'name': extension.name}
)
LOG.debug("L3 agent extension(s) finished router %s "
"delete action.", data['id'])
def ha_state_change(self, context, data):
"""Notify all agent extensions for HA router state change."""

View File

@ -521,6 +521,7 @@ def remove_netns(name, **kwargs):
except OSError as e:
if e.errno != errno.ENOENT:
raise
LOG.debug("Namespace %s deleted.", name)
@privileged.namespace_cmd.entrypoint