'Set API version request based on the request header information.
Microversions starts with /v3, so if a client sends a request for
version 1.0 or 2.0 with the /v3 endpoint, throw an exception.
Sending a header with any microversion to a /v1 or /v2 endpoint will
be ignored.
Note that a microversion must be set for the legacy endpoints. This
will appear as 1.0 and 2.0 for /v1 and /v2.'

def set_api_version_request(self, url):

    if ((API_VERSION_REQUEST_HEADER in self.headers) and ('v3' in url)):
        hdr_string = self.headers[API_VERSION_REQUEST_HEADER]
        hdr_string_list = hdr_string.split(',')
        volume_version = None
        for hdr in hdr_string_list:
            if (VOLUME_SERVICE in hdr):
                (service, volume_version) = hdr.split()
                break
        if (not volume_version):
            raise exception.VersionNotFoundForAPIMethod(version=volume_version)
        if (volume_version == 'latest'):
            self.api_version_request = api_version.max_api_version()
        else:
            self.api_version_request = api_version.APIVersionRequest(volume_version)
            if (not self.api_version_request.matches(api_version.min_api_version(), api_version.max_api_version())):
                raise exception.InvalidGlobalAPIVersion(req_ver=self.api_version_request.get_string(), min_ver=api_version.min_api_version().get_string(), max_ver=api_version.max_api_version().get_string())
    elif ('v1' in url):
        self.api_version_request = api_version.legacy_api_version1()
    elif ('v2' in url):
        self.api_version_request = api_version.legacy_api_version2()
    else:
        self.api_version_request = api_version.APIVersionRequest(api_version._MIN_API_VERSION)
