neutron: add logging during nw info_cache refresh when port is gone

When doing a resize/migrate/reboot, we want to make sure that the
network info we're getting is current and nothing was lost in the
process, so add some logging when what was in the instance_info_cache is
not considered associated with the instance from neutron's point of view
during a refresh.

Related-Bug: #1323658

Change-Id: I0a8d8dcabf0b2c8f0e4552178e8cb99113640b11
This commit is contained in:
Matt Riedemann 2015-03-05 08:12:49 -08:00
parent e6568b2469
commit b09262414a
1 changed files with 7 additions and 0 deletions

View File

@ -1441,6 +1441,7 @@ class API(base_api.NetworkAPI):
data = client.list_ports(**search_opts)
current_neutron_ports = data.get('ports', [])
nw_info_refresh = networks is None and port_ids is None
networks, port_ids = self._gather_port_ids_and_networks(
context, instance, networks, port_ids)
nw_info = network_model.NetworkInfo()
@ -1484,6 +1485,12 @@ class API(base_api.NetworkAPI):
devname=devname,
active=vif_active))
elif nw_info_refresh:
LOG.info(_LI('Port %s from network info_cache is no '
'longer associated with instance in Neutron. '
'Removing from network info_cache.'), port_id,
instance=instance)
return nw_info
def _get_subnets_from_port(self, context, port):