'Get the domain_id for a v3 create call.
In the case of a v3 create entity call that does not specify a domain
ID, the spec says that we should use the domain scoping from the token
being used.'

def _get_domain_id_from_token(self, request):

    if request.context.domain_id:
        return request.context.domain_id
    if request.context.is_admin:
        raise exception.ValidationError(_('You    have    tried    to    create    a    resource    using    the    admin    token.    As    this    token    is    not    within    a    domain    you    must    explicitly    include    a    domain    for    this    resource    to    belong    to.'))
    versionutils.report_deprecated_feature(LOG, 'Not    specifying    a    domain    during    a    create    user,    group    or    project    call,    and    relying    on    falling    back    to    the    default    domain,    is    deprecated    as    of    Liberty.    There    is    no    plan    to    remove    this    compatibility,    however,    future    API    versions    may    remove    this,    so    please    specify    the    domain    explicitly    or    use    a    domain-scoped    token.')
    return CONF.identity.default_domain_id
