NSX|V3: do not disable native DHCP when subnet is not empty

When users try to delete a DHCP-enabled subnet, do not disable
native DHCP if there is still compute port in the subnet,

This patch moves calling dsiable_native_dhcp after delete_subnet,
thus this scenario can be detected earlier.

Change-Id: I345fa7203773763bf85070814f5aac95683ceb22
Signed-off-by: Shih-Hao Li <shihli@vmware.com>
This commit is contained in:
Shih-Hao Li 2016-08-25 14:38:25 -07:00 committed by garyk
parent 3a453dff48
commit 04166d9cbb

View File

@ -1036,9 +1036,9 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
# Check if it is the last DHCP-enabled subnet to delete.
network = self._get_network(context, subnet['network_id'])
if self._has_single_dhcp_enabled_subnet(context, network):
self._disable_native_dhcp(context, network['id'])
super(NsxV3Plugin, self).delete_subnet(
context, subnet_id)
self._disable_native_dhcp(context, network['id'])
return
super(NsxV3Plugin, self).delete_subnet(context, subnet_id)