From 94d86ba8b895b2f223363268020390be387f2818 Mon Sep 17 00:00:00 2001 From: Rodolfo Alonso Hernandez Date: Fri, 28 Jun 2024 12:20:37 +0000 Subject: [PATCH] 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) --- neutron/api/rpc/agentnotifiers/dhcp_rpc_agent_api.py | 1 + .../tests/unit/api/rpc/agentnotifiers/test_dhcp_rpc_agent_api.py | 1 + 2 files changed, 2 insertions(+) diff --git a/neutron/api/rpc/agentnotifiers/dhcp_rpc_agent_api.py b/neutron/api/rpc/agentnotifiers/dhcp_rpc_agent_api.py index dc3963f4ef3..488bb228c98 100644 --- a/neutron/api/rpc/agentnotifiers/dhcp_rpc_agent_api.py +++ b/neutron/api/rpc/agentnotifiers/dhcp_rpc_agent_api.py @@ -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']) diff --git a/neutron/tests/unit/api/rpc/agentnotifiers/test_dhcp_rpc_agent_api.py b/neutron/tests/unit/api/rpc/agentnotifiers/test_dhcp_rpc_agent_api.py index 18b14c44241..c0b11d8c417 100644 --- a/neutron/tests/unit/api/rpc/agentnotifiers/test_dhcp_rpc_agent_api.py +++ b/neutron/tests/unit/api/rpc/agentnotifiers/test_dhcp_rpc_agent_api.py @@ -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(