]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Expunge session contents between plugin requests
authorSalvatore Orlando <salv.orlando@gmail.com>
Wed, 15 Jan 2014 20:45:22 +0000 (12:45 -0800)
committerSalvatore Orlando <salv.orlando@gmail.com>
Wed, 15 Jan 2014 20:45:22 +0000 (12:45 -0800)
In the NVP plugin, metadata processing performs several plugin operations
with the same context (and db session). The first operation might leave
persisted objects in the session instance which then conflict with objects
created in the second operation.

Closes-Bug: #1266482

Change-Id: Ic9e2b952013610647aa222f1a8b6e33504b54b37

neutron/plugins/nicira/dhcp_meta/rpc.py

index bfb5181e35554156014d8e832e29191b724214a9..3f2f0a3af96de91323c86bbcbe4ec0a39a57e106 100644 (file)
@@ -216,6 +216,7 @@ def _destroy_metadata_access_network(plugin, context, router_id, ports):
     plugin.remove_router_interface(
         context, router_id, {'port_id': meta_port['id']})
     greenthread.sleep(0)  # yield
+    context.session.expunge_all()
     try:
         # Remove network (this will remove the subnet too)
         plugin.delete_network(context, meta_net_id)