Notify DHCP agent on Router interface port delete

The traffic stitching implementation deletes the router interface
and creates a Service Target with the gateway IP for the Service
VM to be brought up as the gateway for the provider. The DHCP
agent actually has the router port details in the DHCP hosts file.
The DHCP agent is not receiving a port delete notification from
either core plugin or L3 plugin for router interface port delete.
Hence it ends up having two entries for same IP in the hosts file.
Because of this the Service VM does not get an IP through DHCP.

As a fix, delete port notification is sent after invoking the
remove router interface api.

Change-Id: I485a2eea573bb318cd70c13a2600ffa318778a2b
Closes-Bug: 1552176
This commit is contained in:
mageshgv
2016-03-03 12:44:59 +05:30
parent f21bef3382
commit 588a65ad90

View File

@@ -256,12 +256,28 @@ class LocalAPI(object):
def _remove_router_interface(self, plugin_context, router_id,
interface_info):
# To detach Router interface either port ID or Subnet ID is mandatory
key = 'port_id' if 'port_id' in interface_info else 'subnet_id'
fixed_ips_filter = {key: [interface_info.get(key)]}
filters = {'device_id': [router_id],
'fixed_ips': fixed_ips_filter}
ports = self._get_ports(plugin_context, filters=filters)
try:
self._l3_plugin.remove_router_interface(plugin_context, router_id,
interface_info)
except l3.RouterInterfaceNotFoundForSubnet:
LOG.warning(_LW('Router interface already deleted for subnet %s'),
interface_info)
return
else:
# The DHCP agent is not getting this event for the router
# interface port delete triggered by L3 Plugin. So we are
# sending the notification here
if cfg.CONF.dhcp_agent_notification and ports:
self._dhcp_agent_notifier.notify(plugin_context,
{'port': ports[0]},
'port' + '.delete.end')
def _add_router_gw_interface(self, plugin_context, router_id, gw_info):
return self._l3_plugin.update_router(