create_port in plugin is sometimes called within a transaction

This patch fixes this that problem and allows these tests to pass:
	TestPortsV2.test_create_ports_bulk_emulated
	TestPortsV2.test_create_ports_bulk_native

Change-Id: I44a3e0be7bd5b07538839d883e551ba548da9ebd
This commit is contained in:
Aaron Rosen 2015-07-09 15:45:19 -07:00 committed by Kobi Samoray
parent 84b7c29994
commit 8758b85413

View File

@ -131,7 +131,7 @@ class NsxV3Plugin(db_base_plugin_v2.NeutronDbPluginV2,
tags = utils.build_v3_tags_payload(port['port'])
port['port']['id'] = port_id
# TODO(salv-orlando): Undo logical switch creation on failure
with context.session.begin():
with context.session.begin(subtransactions=True):
neutron_db = super(NsxV3Plugin, self).create_port(context, port)
port["port"].update(neutron_db)
address_bindings = self._build_address_bindings(port['port'])