예제 #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()