Hello Viacheslav:

It seems that the L3 agent error kept in the database some leftovers related to a HA+DVR router. The affected table ``ml2_distributed_port_bindings`` is used to store the binding information of this kind of router. I suggest you to list all the ``ml2_distributed_port_bindings`` records, find the duplicated ones and manually delete those ones that point to hosts where the router is no longer bound.

Regards.

On Tue, Mar 18, 2025 at 3:01 PM Viacheslav Klenov <vklenov@sardinasystems.com> wrote:
Hello,

We ran into a strange issue with neutron l3_agent after failed
live-migration, which failed due to pyroute2/iproute2 version
incompatibility issue

During live-migration l3 agent starts to update router information but
then logs a lot of errors

2025-03-13 12:28:18.041 43002 ERROR neutron.agent.l3.agent [-] Failed to
fetch router information for '4b89508c-beaf-43cf-92a6-9e080c03554d':
oslo_messaging.rpc.client.RemoteError: Remote error:
PendingRollbackError This Session's transaction has been rolled back due
to a previous exception during flush. To begin a new transaction with
this Session, first issue Session.rollback(). Original exception was:
(pymysql.err.IntegrityError) (1062, "Duplicate entry
'506ac36d-4e5c-47a1-96ca-36f739018dfe-hv-017' for key 'PRIMARY'")
[SQL: INSERT INTO ml2_distributed_port_bindings (port_id, host,
router_id, vif_type, vif_details, vnic_type, profile, status) VALUES
(%(port_id)s, %(host)s, %(router_id)s, %(vif_type)s, %(vif_details)s,
%(vnic_type)s, %(profile)s, %(status)s)]
[parameters: {'port_id': '506ac36d-4e5c-47a1-96ca-36f739018dfe', 'host':
'hv-017', 'router_id': '4b89508c-beaf-43cf-92a6-9e080c03554d',
'vif_type': 'unbound', 'vif_details': '', 'vnic_type': 'normal',
'profile': '', 'status': 'DOWN'}]

(log attached)

Before the migration there is no records in neutron
ml2_distributed_port_bindings table with a hostname from the error

after the errors the migrated VM is seemingly functional

The error reproduces every time on live-migration even after
pyroute2/iproute2 incompatibility was fixed

Any insight into why is this happening or a way to fix it would be
greatly appreciated


--
Viacheslav
-----------------
Viacheslav Klenov
vklenov@sardinasystems.com |
www.sardinasystems.com | @sardinasystems | https://www.linkedin.com/company/sardina-systems

"We build technology so that others can build more technology.”