From 72b979f92cb71b4b417e7be03e2377cacc449ea9 Mon Sep 17 00:00:00 2001 From: Matt Riedemann Date: Tue, 30 Jul 2019 17:20:42 -0400 Subject: [PATCH] neutron: log something more useful in _get_instance_nw_info This method is currently logging something like this: Jul 30 20:47:58 devstack nova-compute[23811]: DEBUG \ nova.network.neutronv2.api [None req-1bba63ae-86d8-4a97-be63-18f18c9ae662 \ None None] [instance: 3e0a7f65-34ac-4d73-83ed-96d36fdefd54] \ _get_instance_nw_info() {{(pid=23811) _get_instance_nw_info \ /opt/stack/nova/nova/network/neutronv2/api.py:1751}} Logging the method name, which already gets logged, is not very useful. This change uses the parameters to the method to add some more useful log messages. Currently the only time force_refresh is True is when the _heal_instance_info_cache periodic task runs. Currently refresh_vif_id is only ever not None when a network-changed event is received with a particular port id in the event tag parameter. Change-Id: Iccda422a3900821ca5476d8888e935568884f321 --- nova/network/neutronv2/api.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/nova/network/neutronv2/api.py b/nova/network/neutronv2/api.py index d0106378f8..a3d9e47fa8 100644 --- a/nova/network/neutronv2/api.py +++ b/nova/network/neutronv2/api.py @@ -1748,7 +1748,15 @@ class API(base_api.NetworkAPI): # NOTE(danms): This is an inner method intended to be called # by other code that updates instance nwinfo. It *must* be # called with the refresh_cache-%(instance_uuid) lock held! - LOG.debug('_get_instance_nw_info()', instance=instance) + if force_refresh: + LOG.debug('Forcefully refreshing network info cache for instance', + instance=instance) + elif refresh_vif_id: + LOG.debug('Refreshing network info cache for port %s', + refresh_vif_id, instance=instance) + else: + LOG.debug('Building network info cache for instance', + instance=instance) # Ensure that we have an up to date copy of the instance info cache. # Otherwise multiple requests could collide and cause cache # corruption.