summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-03-03 02:47:45 +0000
committerGerrit Code Review <review@openstack.org>2015-03-03 02:47:45 +0000
commitf9b18a231f74f225f5963bb5363cdf5f09b63d7c (patch)
treea1785a04c946b447ed0c644a64683a994c8c0fb8
parent1cb23b4247f5e9c864c111cf86ddfdbaf4a1d558 (diff)
parentced57098793fa063d881d522b0a695b5c414cba7 (diff)
Merge "Fix MySQL deadlock issue"
-rw-r--r--networking_brocade/vyatta/vrouter/neutron_plugin.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/networking_brocade/vyatta/vrouter/neutron_plugin.py b/networking_brocade/vyatta/vrouter/neutron_plugin.py
index 03cdad3..cfbef7a 100644
--- a/networking_brocade/vyatta/vrouter/neutron_plugin.py
+++ b/networking_brocade/vyatta/vrouter/neutron_plugin.py
@@ -161,6 +161,8 @@ class VyattaVRouterMixin(common_db_mixin.CommonDbMixin,
161 def delete_router(self, context, router_id): 161 def delete_router(self, context, router_id):
162 LOG.debug("Vyatta vRouter Plugin::Delete router: %s", router_id) 162 LOG.debug("Vyatta vRouter Plugin::Delete router: %s", router_id)
163 163
164 gw_port = None
165
164 with context.session.begin(subtransactions=True): 166 with context.session.begin(subtransactions=True):
165 router = self._get_router(context, router_id) 167 router = self._get_router(context, router_id)
166 168
@@ -175,12 +177,14 @@ class VyattaVRouterMixin(common_db_mixin.CommonDbMixin,
175 filters=device_filter) 177 filters=device_filter)
176 178
177 if ports: 179 if ports:
178 port = ports[0] 180 gw_port = ports[0]
179 router.gw_port = None 181 router.gw_port = None
180 context.session.add(router) 182 context.session.add(router)
181 183
182 self._delete_router_port(context, router_id, port) 184 if gw_port:
185 self._delete_router_port(context, router_id, gw_port)
183 186
187 with context.session.begin(subtransactions=True):
184 context.session.delete(router) 188 context.session.delete(router)
185 189
186 self.driver.delete_router(context, router_id) 190 self.driver.delete_router(context, router_id)