Expunge session contents between plugin requests

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
This commit is contained in:
Salvatore Orlando
2014-01-15 12:45:22 -08:00
parent f89cf127d9
commit f6d384d7a2

View 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)