def concurrent_increment(s):
     db_api.sqla_remove(se.Session, 'before_commit',
                        concurrent_increment)
     # slip in a concurrent update that will bump the revision
     plugin = directory.get_plugin()
     plugin.update_port(nctx.get_admin_context(),
                        port['port']['id'], new)
     raise db_exc.DBDeadlock()
 def concurrent_increment(s):
     db_api.sqla_remove(se.Session, 'before_commit',
                        concurrent_increment)
     # slip in a concurrent update that will bump the revision
     plugin = directory.get_plugin()
     plugin.update_port(nctx.get_admin_context(),
                        port['port']['id'], new)
     raise db_exc.DBDeadlock()
Exemple #3
0
 def unregister_events(self):
     try:
         lib_db_api.sqla_remove(self._model_class, 'after_insert',
                                self._db_event_handler)
         lib_db_api.sqla_remove(self._model_class, 'after_delete',
                                self._db_event_handler)
         lib_db_api.sqla_remove(se.Session, 'after_bulk_delete',
                                self._except_bulk_delete)
     except sql_exc.InvalidRequestError:
         LOG.warning("No sqlalchemy event for resource %s found", self.name)
Exemple #4
0
 def unregister_events(self):
     try:
         lib_db_api.sqla_remove(self._model_class, 'after_insert',
                                self._db_event_handler)
         lib_db_api.sqla_remove(self._model_class, 'after_delete',
                                self._db_event_handler)
         lib_db_api.sqla_remove(se.Session, 'after_bulk_delete',
                                self._except_bulk_delete)
     except sql_exc.InvalidRequestError:
         LOG.warning("No sqlalchemy event for resource %s found",
                     self.name)