Merge "Add logging to dangling port to ml2 delete_subnet"

This commit is contained in:
Jenkins 2015-04-10 13:02:15 +00:00 committed by Gerrit Code Review
commit 9c0f00a0a7
2 changed files with 12 additions and 5 deletions

View 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)

View 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