In some circumstances (like the one triggered by the test_dhcp_ipv6 testcase)
calls to deleting a port and calls to deleting subnets can happen in straight
sequence.
If this happens the execution of the operations can interleave leading
to the subnet deletion to fail because the port has already gone. This patch
ensures a missing port is handled correctly.
The method delete_subnet is ginormous and hence impossible to test at a unit
level without proper refactoring. That can happen with a follow-up patch.
Closes-bug: #
1490832
Change-Id: I80c3733c93b2b66c2a1c4bc3bc24272afdd88b1f
break
for a in allocated:
- if a.port_id:
+ if a.port:
# calling update_port() for each allocation to remove the
# IP from the port and call the MechanismDrivers
data = {attributes.PORT:
if ip.subnet_id != id]}}
try:
self.update_port(context, a.port_id, data)
+ except exc.PortNotFound:
+ LOG.debug("Port %s deleted concurrently", a.port_id)
except Exception:
with excutils.save_and_reraise_exception():
LOG.exception(_LE("Exception deleting fixed_ip "