NSX|V3: Add codes to handle corner cases in native DHCP support
1. delete_network failed because native DHCP port was manually deleted 2. create_subnet was rolled back, but old entries still exist in backend Change-Id: I9e28438ff5a7eab9489a921d834eab8a65044aa4
This commit is contained in:
parent
82fea9652b
commit
99638abd8f
@ -897,6 +897,12 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
|
|||||||
# LogicalDhcpServer on the backend. Then create the corresponding
|
# LogicalDhcpServer on the backend. Then create the corresponding
|
||||||
# logical port for the Neutron port with DHCP attachment as the
|
# logical port for the Neutron port with DHCP attachment as the
|
||||||
# LogicalDhcpServer UUID.
|
# LogicalDhcpServer UUID.
|
||||||
|
|
||||||
|
# Delete obsolete settings if exist. This could happen when a
|
||||||
|
# previous failed transaction was rolled back. But the backend
|
||||||
|
# entries are still there.
|
||||||
|
self._disable_native_dhcp(context, network['id'])
|
||||||
|
|
||||||
port_data = {
|
port_data = {
|
||||||
"name": "",
|
"name": "",
|
||||||
"admin_state_up": True,
|
"admin_state_up": True,
|
||||||
@ -964,9 +970,16 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
|
|||||||
return
|
return
|
||||||
|
|
||||||
if dhcp_service['port_id']:
|
if dhcp_service['port_id']:
|
||||||
self.delete_port(context, dhcp_service['port_id'])
|
try:
|
||||||
|
self.delete_port(context, dhcp_service['port_id'])
|
||||||
|
except Exception:
|
||||||
|
# This could happen when the port has been manually deleted.
|
||||||
|
LOG.error(_LE("Failed to delete DHCP port %(port)s for "
|
||||||
|
"network %(network)s"),
|
||||||
|
{'port': dhcp_service['port_id'],
|
||||||
|
'network': network_id})
|
||||||
else:
|
else:
|
||||||
LOG.error(_LE("Unable to find DHCP port for network %s"),
|
LOG.error(_LE("DHCP port is not configured for network %s"),
|
||||||
network_id)
|
network_id)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user