Merge "NSX|V3: address edge case of subnet deletion when attached to router"

This commit is contained in:
Zuul 2017-11-21 15:47:23 +00:00 committed by Gerrit Code Review
commit f036f5a988
1 changed files with 3 additions and 0 deletions

View File

@ -1533,6 +1533,9 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
def delete_subnet(self, context, subnet_id):
# TODO(berlin): cancel public external subnet announcement
if cfg.CONF.nsx_v3.native_dhcp_metadata:
# Ensure that subnet is not deleted if attached to router.
self._subnet_check_ip_allocations_internal_router_ports(
context, subnet_id)
subnet = self.get_subnet(context, subnet_id)
if subnet['enable_dhcp']:
lock = 'nsxv3_network_' + subnet['network_id']