Пример #1
0
 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()
Пример #2
0
 def unregister_events(self):
     try:
         db_api.sqla_remove(self._model_class, 'after_insert',
                            self._db_event_handler)
         db_api.sqla_remove(self._model_class, 'after_delete',
                            self._db_event_handler)
         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)
Пример #3
0
 def unregister_events(self):
     try:
         db_api.sqla_remove(self._model_class, 'after_insert',
                            self._db_event_handler)
         db_api.sqla_remove(self._model_class, 'after_delete',
                            self._db_event_handler)
         db_api.sqla_remove(se.Session, 'after_bulk_delete',
                            self._except_bulk_delete)
     except sql_exc.InvalidRequestError:
         LOG.warning(_LW("No sqlalchemy event for resource %s found"),
                     self.name)
Пример #4
0
 def concurrent_increment(s):
     db_api.sqla_remove(se.Session, 'before_commit',
                        concurrent_increment)
     # slip in a concurrent update that will bump the revision
     self._update('ports', port['port']['id'], new)
     raise db_exc.DBDeadlock()