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

There is a edge case when when a subnet deletion fails due to it
being attached to a router. If the subnet did not have an attached
instance ports then the DHCP server was deleted.

Subsequent instance ports will not get IP addresses.

Change-Id: I12ffcda503f3647d481d574a09104e837c7af5d6
This commit is contained in:
Gary Kotton 2017-11-04 10:40:46 +02:00
parent 28efdef15d
commit 09d3049be1
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']