summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2014-11-13 22:22:30 +0000
committerGerrit Code Review <review@openstack.org>2014-11-13 22:22:30 +0000
commit5c52c471c777442309e6febd2eb43585445b1616 (patch)
treec977a91b3421cd189bfa307d791682dc7dd78ae8
parent67461cc91c9bde685e7008204da45351d64ad4d6 (diff)
parenta575cb7cb6c30d843c3ac824e5f2f11a5055a9fb (diff)
downloadneutron-5c52c471c777442309e6febd2eb43585445b1616.tar.gz
Merge "_update_router_db: don't hold open transactions" into stable/juno
-rw-r--r--neutron/db/l3_db.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/neutron/db/l3_db.py b/neutron/db/l3_db.py
index 83428a4075..cd4be99253 100644
--- a/neutron/db/l3_db.py
+++ b/neutron/db/l3_db.py
@@ -170,10 +170,8 @@ class L3_NAT_dbonly_mixin(l3.RouterPluginBase):
return self._make_router_dict(router_db)
def _update_router_db(self, context, router_id, data, gw_info):
- """Update the DB object and related gw info, if available."""
+ """Update the DB object."""
with context.session.begin(subtransactions=True):
- if gw_info != attributes.ATTR_NOT_SPECIFIED:
- self._update_router_gw_info(context, router_id, gw_info)
router_db = self._get_router(context, router_id)
if data:
router_db.update(data)
@@ -189,6 +187,10 @@ class L3_NAT_dbonly_mixin(l3.RouterPluginBase):
if gw_info != attributes.ATTR_NOT_SPECIFIED:
candidates = self._check_router_needs_rescheduling(
context, id, gw_info)
+ # Update the gateway outside of the DB update since it involves L2
+ # calls that don't make sense to rollback and may cause deadlocks
+ # in a transaction.
+ self._update_router_gw_info(context, id, gw_info)
else:
candidates = None
router_db = self._update_router_db(context, id, r, gw_info)