Add retry to _create_ha_port_binding

Since _create_ha_port_binding creates a RouterPort object, it bumps the
revision of the Router in an atomic fashion. If something else modified
the Router concurrently, StaleDataError may be thrown. In that case we
just want to retry the function.

Closes-Bug: #1654998
Change-Id: I7a4c58a4476ca85209d28c2d3a2cb61268e3cab6
This commit is contained in:
John Schwarz 2017-01-09 14:26:22 +02:00
parent 5f2a2b8095
commit 0378194f59

View File

@ -295,6 +295,7 @@ class L3_HA_NAT_db_mixin(l3_dvr_db.L3_NAT_with_dvr_db_mixin,
return num_agents
@db_api.retry_if_session_inactive()
def _create_ha_port_binding(self, context, router_id, port_id):
try:
with context.session.begin():