]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Invoke _process_l3_create within plugin session
authorHemanth Ravi <hemanth.ravi@oneconvergence.com>
Mon, 31 Mar 2014 00:48:21 +0000 (17:48 -0700)
committerHemanth Ravi <hemanth.ravi@oneconvergence.com>
Mon, 31 Mar 2014 00:48:21 +0000 (17:48 -0700)
_process_l3_create should be invoked with a plugin session, else
externalnetworks table is not populated for networks with
router:external=True. Added the missing plugin session.

Change-Id: I09c49dea9474f91a70aef829c1596fbb9089d6cf
Closes-Bug: #1299946

neutron/plugins/oneconvergence/plugin.py

index daf85ee6d9239835a30b3a1be1f829f54d835ea9..e4aea6f90a4ef5751b6b2322b36ef0661d92b676 100644 (file)
@@ -185,17 +185,19 @@ class OneConvergencePluginV2(db_base_plugin_v2.NeutronDbPluginV2,
 
         network['network']['id'] = net['id']
 
-        try:
-            neutron_net = super(OneConvergencePluginV2,
-                                self).create_network(context, network)
-
-            #following call checks whether the network is external or not and
-            #if it is external then adds this network to externalnetworks
-            #table of neutron db
-            self._process_l3_create(context, neutron_net, network['network'])
-        except nvsdexception.NVSDAPIException:
-            with excutils.save_and_reraise_exception():
-                self.nvsdlib.delete_network(net)
+        with context.session.begin(subtransactions=True):
+            try:
+                neutron_net = super(OneConvergencePluginV2,
+                                    self).create_network(context, network)
+
+                #following call checks whether the network is external or not
+                #and if it is external then adds this network to
+                #externalnetworks table of neutron db
+                self._process_l3_create(context, neutron_net,
+                                        network['network'])
+            except nvsdexception.NVSDAPIException:
+                with excutils.save_and_reraise_exception():
+                    self.nvsdlib.delete_network(net)
 
         return neutron_net