Add the port "fixed_ips" information in the DHCP RPC

In [1], a method to process the DHCP events in the correct order was
implemented. That method checks the port events in order to match
the "fixed_ips" field. That implies the Neutron server provides this
information in the port event, sent via RPC.

However in [2], the "fixed_ips" information was removed from the
``DhcpAgentNotifyAPI._after_router_interface_deleted``, causing a
periodic error in the ``DHCPResourceUpdate.__lt__`` method, as reported
in the LP bug. This patch is restoring this field in the RPC message.

[1]https://review.opendev.org/c/openstack/neutron/+/773160
[2]https://review.opendev.org/c/openstack/neutron/+/639814

Closes-Bug: #2071426
Change-Id: If1362b9b91794e74e8cf6bb233e661fba9fb3b26
(cherry picked from commit b0081ac6c0eca93f7589f5c910d0f6385d83dd47)
This commit is contained in:
Rodolfo Alonso Hernandez 2024-06-28 12:20:37 +00:00
parent c6d4a3e364
commit 94d86ba8b8
2 changed files with 2 additions and 0 deletions
neutron
api/rpc/agentnotifiers
tests/unit/api/rpc/agentnotifiers

@ -284,6 +284,7 @@ class DhcpAgentNotifyAPI(object):
port = payload.metadata.get('port')
self._notify_agents(payload.context, 'port_delete_end',
{'port_id': port['id'],
'fixed_ips': port['fixed_ips'],
'network_id': port['network_id']},
port['network_id'])

@ -251,6 +251,7 @@ class TestDhcpAgentNotifyAPI(base.BaseTestCase):
payload = events.DBEventPayload(
mock.Mock(), metadata={
'port': {'id': 'foo_port_id',
'fixed_ips': mock.ANY,
'network_id': 'foo_network_id'}})
self._test__notify_agents_with_function(
lambda: self.notifier._after_router_interface_deleted(