def event_log_create(self, values):
    if (not values.get('uuid')):
        values['uuid'] = utils.generate_uuid()
    event_log = models.EventLog()
    event_log.update(values)
    count = self.event_log_get_count()
    max_log = config.get_max_event_log()
    if (count >= int(max_log)):
        self.delete_oldest_event_log()
    with _session_for_write() as session:
        try:
            session.add(event_log)
            session.flush()
        except db_exc.DBDuplicateEntry:
            raise exceptions.EventLogAlreadyExists(id=values['id'])
        return event_log
def event_log_create(self, values):
    if (not values.get('uuid')):
        values['uuid'] = utils.generate_uuid()
    event_log = models.EventLog()
    event_log.update(values)
    count = self.event_log_get_count()
    max_log = config.get_max_event_log()
    if (count >= int(max_log)):
        self.delete_oldest_event_log()
    with _session_for_write() as session:
        try:
            session.add(event_log)
            session.flush()
        except db_exc.DBDuplicateEntry:
            raise exceptions.EventLogAlreadyExists(id=values['id'])
        return event_log