]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Removing rpc communication from db transaction
authorJakub Libosvar <libosvar@redhat.com>
Thu, 3 Oct 2013 17:45:09 +0000 (19:45 +0200)
committerJakub Libosvar <libosvar@redhat.com>
Tue, 15 Oct 2013 09:11:05 +0000 (11:11 +0200)
In a transaction context of ExtraRoute_db_mixin.update_router() was
called super method that uses subtransaction and communication with l3
agent. In case of agent's heartbeat happens while there is running
transaction, update heartbeat in agents table gets stuck in a deadlock.

Closes-Bug: #1211915
Change-Id: I96e6a9d7172d5a0e3e720a81fcd10f04c40aef07

neutron/db/extraroute_db.py

index af5b9102eb8be3a81532f2156b68aa641e4da4c0..55ae98696f7b860279d422bff6f20874b6e97de1 100644 (file)
@@ -71,13 +71,11 @@ class ExtraRoute_db_mixin(l3_db.L3_NAT_db_mixin):
             #check if route exists and have permission to access
             router_db = self._get_router(context, id)
             if 'routes' in r:
-                self._update_extra_routes(context,
-                                          router_db,
-                                          r['routes'])
-            router_updated = super(ExtraRoute_db_mixin, self).update_router(
-                context, id, router)
-            router_updated['routes'] = self._get_extra_routes_by_router_id(
-                context, id)
+                self._update_extra_routes(context, router_db, r['routes'])
+            routes = self._get_extra_routes_by_router_id(context, id)
+        router_updated = super(ExtraRoute_db_mixin, self).update_router(
+            context, id, router)
+        router_updated['routes'] = routes
 
         return router_updated