]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
nvp:log only in rm router iface if port not found
authorSalvatore Orlando <salv.orlando@gmail.com>
Wed, 16 Oct 2013 22:11:34 +0000 (15:11 -0700)
committerSalvatore Orlando <salv.orlando@gmail.com>
Thu, 17 Oct 2013 12:14:44 +0000 (05:14 -0700)
The code currently raises when it's not able to find the port to be
deleted on the backend. This might happen, for instance, when the
port is manually removed or, in some cases, if port creation failed
in the first place.

There's little sense in raising when a resource to be removed is not
found; therefore this patch replaces the raise statement with a log
statement.

Bug 1240720

Change-Id: Ifa756b07ef41346a44325341c8e0e8994dc64dde

neutron/plugins/nicira/NeutronPlugin.py

index ec791f2893bf89eb09583d789841e455c7cd44d9..f9d84d2fd176435cea3d0d3a804abe990e3feb73 100644 (file)
@@ -520,8 +520,12 @@ class NvpPluginV2(addr_pair_db.AllowedAddressPairsMixin,
         nvp_port_id = self._nvp_get_port_id(context, self.cluster,
                                             port_data)
         if not nvp_port_id:
-            raise q_exc.PortNotFound(port_id=port_data['id'])
-
+            LOG.warn(_("Neutron port %(port_id)s not found on NVP backend. "
+                       "Terminating delete operation. A dangling router port "
+                       "might have been left on router %(router_id)s"),
+                     {'port_id': port_data['id'],
+                      'router_id': lrouter_id})
+            return
         try:
             nvplib.delete_peer_router_lport(self.cluster,
                                             lrouter_id,