Merge "Ensure that session is rolled back on bulk creates"

This commit is contained in:
Jenkins 2014-02-23 06:17:39 +00:00 committed by Gerrit Code Review
commit 141d462a85

View File

@ -898,11 +898,11 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2,
objects.append(obj_creator(context, item))
context.session.commit()
except Exception:
context.session.rollback()
with excutils.save_and_reraise_exception():
LOG.error(_("An exception occurred while creating "
"the %(resource)s:%(item)s"),
{'resource': resource, 'item': item})
context.session.rollback()
return objects
def create_network_bulk(self, context, networks):