Merge "Ensure that session is rolled back on bulk creates"
This commit is contained in:
commit
141d462a85
@ -898,11 +898,11 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2,
|
|||||||
objects.append(obj_creator(context, item))
|
objects.append(obj_creator(context, item))
|
||||||
context.session.commit()
|
context.session.commit()
|
||||||
except Exception:
|
except Exception:
|
||||||
|
context.session.rollback()
|
||||||
with excutils.save_and_reraise_exception():
|
with excutils.save_and_reraise_exception():
|
||||||
LOG.error(_("An exception occurred while creating "
|
LOG.error(_("An exception occurred while creating "
|
||||||
"the %(resource)s:%(item)s"),
|
"the %(resource)s:%(item)s"),
|
||||||
{'resource': resource, 'item': item})
|
{'resource': resource, 'item': item})
|
||||||
context.session.rollback()
|
|
||||||
return objects
|
return objects
|
||||||
|
|
||||||
def create_network_bulk(self, context, networks):
|
def create_network_bulk(self, context, networks):
|
||||||
|
Loading…
Reference in New Issue
Block a user