]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Fix empty network deletion in db_base_plugin for postgresql
authorEugene Nikanorov <enikanorov@mirantis.com>
Sat, 21 Dec 2013 20:48:48 +0000 (00:48 +0400)
committerEugene Nikanorov <enikanorov@mirantis.com>
Wed, 1 Jan 2014 18:35:57 +0000 (22:35 +0400)
Need to disable joined loads for port query in delete_network
as in other methods.

No unit test is being added, because the problem is not reproducible with
sqlite.

Closes-Bug: #1261652

Change-Id: I7a015be6f2f9b8ae43bc29a767d16af30120f13f

neutron/db/db_base_plugin_v2.py

index d871c174fbc5c598d5275d1437095e8806b46950..0eaa237d7263f2dea8270c10d91fd43e2c5ade21 100644 (file)
@@ -991,8 +991,10 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2,
 
             filters = {'network_id': [id]}
             # NOTE(armando-migliaccio): stick with base plugin
-            ports = self._get_ports_query(
-                context, filters=filters).with_lockmode('update')
+            query = context.session.query(
+                models_v2.Port).enable_eagerloads(False)
+            ports = self._apply_filters_to_query(
+                query, models_v2.Port, filters).with_lockmode('update')
 
             # check if there are any tenant owned ports in-use
             only_auto_del = all(p['device_owner'] in AUTO_DELETE_PORT_OWNERS