'Create a message with the specified information.'

def create(self, context, action, resource_type=message_field.Resource.VOLUME, resource_uuid=None, exception=None, detail=None, level='ERROR'):

    LOG.info('Creating    message    record    for    request_id    =    %s', context.request_id)
    expires_at = (timeutils.utcnow() + datetime.timedelta(seconds=CONF.message_ttl))
    detail_id = message_field.translate_detail_id(exception, detail)
    message_record = {'project_id': context.project_id, 'request_id': context.request_id, 'resource_type': resource_type, 'resource_uuid': resource_uuid, 'action_id': (action[0] if action else ''), 'message_level': level, 'event_id': ('VOLUME_%s_%s_%s' % (resource_type, action[0], detail_id)), 'detail_id': detail_id, 'expires_at': expires_at}
    try:
        self.db.message_create(context, message_record)
    except Exception:
        LOG.exception('Failed    to    create    message    record    for    request_id    %s', context.request_id)
