def accelerator_delete(self, context, uuid): with _session_for_write(): query = model_query(context, models.Accelerator) query = add_identity_filter(query, uuid) count = query.delete() if count != 1: raise exception.AcceleratorNotFound(uuid=uuid)
def _do_update_accelerator(self, context, uuid, values): with _session_for_write(): query = model_query(context, models.Accelerator) query = add_identity_filter(query, uuid) try: ref = query.with_lockmode('update').one() except NoResultFound: raise exception.AcceleratorNotFound(uuid=uuid) ref.update(values) return ref
def accelerator_get(self, context, uuid): query = model_query(context, models.Accelerator).filter_by(uuid=uuid) try: return query.one() except NoResultFound: raise exception.AcceleratorNotFound(uuid=uuid)