Browse Source

Merge "Fix MySQL deadlock issue"

tags/kilo-eol
Jenkins 4 years ago
parent
commit
f9b18a231f
1 changed files with 6 additions and 2 deletions
  1. 6
    2
      networking_brocade/vyatta/vrouter/neutron_plugin.py

+ 6
- 2
networking_brocade/vyatta/vrouter/neutron_plugin.py View File

@@ -161,6 +161,8 @@ class VyattaVRouterMixin(common_db_mixin.CommonDbMixin,
161 161
     def delete_router(self, context, router_id):
162 162
         LOG.debug("Vyatta vRouter Plugin::Delete router: %s", router_id)
163 163
 
164
+        gw_port = None
165
+
164 166
         with context.session.begin(subtransactions=True):
165 167
             router = self._get_router(context, router_id)
166 168
 
@@ -175,12 +177,14 @@ class VyattaVRouterMixin(common_db_mixin.CommonDbMixin,
175 177
                                                 filters=device_filter)
176 178
 
177 179
             if ports:
178
-                port = ports[0]
180
+                gw_port = ports[0]
179 181
                 router.gw_port = None
180 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 188
             context.session.delete(router)
185 189
 
186 190
         self.driver.delete_router(context, router_id)

Loading…
Cancel
Save