Merge "Properly synchronize status for ports deleted from backend"

This commit is contained in:
Jenkins 2013-09-25 01:03:47 +00:00 committed by Gerrit Code Review
commit f96aacf16f
2 changed files with 15 additions and 13 deletions

View File

@ -741,16 +741,16 @@ class NvpPluginV2(addr_pair_db.AllowedAddressPairsMixin,
cluster, cluster,
neutron_port['network_id'], neutron_port['network_id'],
neutron_port['id']) neutron_port['id'])
if nvp_port: except NvpApiClient.NvpApiException:
nicira_db.add_neutron_nvp_port_mapping(
context.session,
neutron_port['id'],
nvp_port['uuid'])
return nvp_port['uuid']
except Exception:
LOG.exception(_("Unable to find NVP uuid for Neutron port %s"), LOG.exception(_("Unable to find NVP uuid for Neutron port %s"),
neutron_port['id']) neutron_port['id'])
if nvp_port:
nicira_db.add_neutron_nvp_port_mapping(
context.session, neutron_port['id'],
nvp_port['uuid'])
return nvp_port['uuid']
def _extend_fault_map(self): def _extend_fault_map(self):
"""Extends the Neutron Fault Map. """Extends the Neutron Fault Map.

View File

@ -381,17 +381,19 @@ class NvpSynchronizer():
lswitchport = nvplib.get_port( lswitchport = nvplib.get_port(
self._cluster, neutron_port_data['network_id'], self._cluster, neutron_port_data['network_id'],
lp_uuid, relations='LogicalPortStatus') lp_uuid, relations='LogicalPortStatus')
except exceptions.PortNotFoundOnNetwork: except (exceptions.PortNotFoundOnNetwork):
# NOTE(salv-orlando): We should be catching # NOTE(salv-orlando): We should be catching
# NvpApiClient.ResourceNotFound here # NvpApiClient.ResourceNotFound here instead
# The logical switch port was not found # of PortNotFoundOnNetwork when the id exists but
# the logical switch port was not found
LOG.warning(_("Logical switch port for neutron port %s " LOG.warning(_("Logical switch port for neutron port %s "
"not found on NVP."), neutron_port_data['id']) "not found on NVP."), neutron_port_data['id'])
lswitchport = None lswitchport = None
else: else:
# Update the cache # If lswitchport is not None, update the cache.
# It could be none if the port was deleted from the backend
if lswitchport:
self._nvp_cache.update_lswitchport(lswitchport) self._nvp_cache.update_lswitchport(lswitchport)
# Note(salv-orlando): It might worth adding a check to verify neutron # Note(salv-orlando): It might worth adding a check to verify neutron
# resource tag in nvp entity matches Neutron id. # resource tag in nvp entity matches Neutron id.
# By default assume things go wrong # By default assume things go wrong