Thanks a lot for your research! It helped me a lot with debugging.
About your suggestion:
I see that there is 2 problems when there is extra L3HARouterAgentPortBinding with l3_agent_id=None and when there is duplication with l3_agent_id.
When I checked more I realize that _create_ha_port_binding https://github.com/openstack/neutron/blob/master/neutron/db/l3_hamode_db.py#L304 creates L3HARouterAgentPortBinding with l3_agent_id=None http://paste.openstack.org/show/474814/, so UniqueConstraint won't help here. The only way to prevent this error is to check that number of already created ha port bindings for router is less than max_l3_agents_per_router. This should solution for the first problem,but for resolving the second one we will need to add UniqueConstraint to prevent updating L3HARouterAgentPortBinding with duplicate.
@Assaf Muller
Thanks a lot for your research! It helped me a lot with debugging.
About your suggestion:
I see that there is 2 problems when there is extra L3HARouterAgent PortBinding with l3_agent_id=None and when there is duplication with l3_agent_id.
When I checked more I realize that _create_ ha_port_ binding https:/ /github. com/openstack/ neutron/ blob/master/ neutron/ db/l3_hamode_ db.py#L304 creates L3HARouterAgent PortBinding with l3_agent_id=None http:// paste.openstack .org/show/ 474814/, so UniqueConstraint won't help here. The only way to prevent this error is to check that number of already created ha port bindings for router is less than max_l3_ agents_ per_router. This should solution for the first problem,but for resolving the second one we will need to add UniqueConstraint to prevent updating L3HARouterAgent PortBinding with duplicate.