]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Add logging to dangling port to ml2 delete_subnet
authorEugene Nikanorov <enikanorov@mirantis.com>
Tue, 7 Apr 2015 22:23:22 +0000 (02:23 +0400)
committerEugene Nikanorov <enikanorov@mirantis.com>
Wed, 8 Apr 2015 22:23:46 +0000 (01:23 +0300)
This is useful when trouble shooting test failures.
Also, in db_base_plugin_v2, log only port_id instead of
full allocation object.

Change-Id: I3d77318aee70836de125687a7f6c0f495d545f21
Related-Bug: #1357055

neutron/db/db_base_plugin_v2.py
neutron/plugins/ml2/plugin.py

index f7bcf8db538388c8e25afd70d8c71776621a7193..01f431fa7531690682cb53453fac499b23f185d2 100644 (file)
@@ -1514,9 +1514,11 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2,
             if not is_auto_addr_subnet:
                 alloc = self._subnet_check_ip_allocations(context, id)
                 if alloc:
-                    LOG.info(_LI("Found IP allocation %(alloc)s on subnet "
+                    LOG.info(_LI("Found port (%(port_id)s, %(ip)s) having IP "
+                                 "allocation on subnet "
                                  "%(subnet)s, cannot delete"),
-                             {'alloc': alloc,
+                             {'ip': alloc.ip_address,
+                              'port_id': alloc.port_id,
                               'subnet': id})
                     raise n_exc.SubnetInUse(subnet_id=id)
 
index 66d989caea032b203580316543b63772aacce92e..fa5b0e9a7369b44212d9e223c6a7ea3ee1099f21 100644 (file)
@@ -873,9 +873,14 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
                 # the isolation level is set to READ COMMITTED allocations made
                 # concurrently will be returned by this query
                 if not is_auto_addr_subnet:
-                    if self._subnet_check_ip_allocations(context, id):
-                        LOG.debug("Found IP allocations on subnet %s, "
-                                  "cannot delete", id)
+                    alloc = self._subnet_check_ip_allocations(context, id)
+                    if alloc:
+                        LOG.info(_LI("Found port (%(port_id)s, %(ip)s) "
+                                     "having IP allocation on subnet "
+                                     "%(subnet)s, cannot delete"),
+                                 {'ip': alloc.ip_address,
+                                  'port_id': alloc.port_id,
+                                  'subnet': id})
                         raise exc.SubnetInUse(subnet_id=id)
 
                 # If allocated is None, then all the IPAllocation were