2015-05-05 19:55:44 |
Sylvain Bauza |
description |
When using keystone V3 authentication for cinder, I got error "BadRequest: Malformed request url (HTTP 400)".
I am testing on Juno release, my keystone v3 env is like this,
export OS_USERNAME="admin"
export OS_PASSWORD="password"
export OS_DOMAIN_NAME=default
export OS_AUTH_URL="http://$MY_HOST:35357/v3"
export OS_IDENTITY_API_VERSION=3
My endpoint of cinder public URL is like http://**.**.**.**:8776/v1/cbe4b1d87fbb4318be379a79a570b7ec (I hided the real IP)
When run command "openstack --debug volume list" or "openstack --debug volume create --size 1 jin", I got this BadRequest error. From debug info, this error comes from cinder server. I added log in cinder/api/openstack/wsgi.py function _process_stack(), found the context.project_id is None while project_id has a value, here return the error.
if (context and project_id and (project_id != context.project_id)):
msg = _("Malformed request url")
return Fault(webob.exc.HTTPBadRequest(explanation=msg))
I compared with another keystone V2 authentication server, the context.project_id is same as project_id. Maybe this is difference, in v2 server the REQ has one more Project-id like "curl -i -H "X-Auth-Project-Id: admin".
I found the cinder.context maybe come from cinder/api/middleware/auth.py, the project_id in cinder.context may not be assigned a value in keystone v3 authentication scenario.
ERROR log is as below:
REQ: curl -i http://**.**.**.**:8776/v1/cbe4b1d87fbb4318be379a79a570b7ec/volumes/detail -X GET -H "User-Agent: python-cinderclient" -H "Accept: application/json" -H "X-Auth-Token: e883e05a887144d4ae70151c976ce666"
INFO: requests.packages.urllib3.connectionpool Starting new HTTP connection (1): **.**.**.**
DEBUG: requests.packages.urllib3.connectionpool "GET /v1/cbe4b1d87fbb4318be379a79a570b7ec/volumes/detail HTTP/1.1" 400 65
DEBUG: cinderclient.client RESP: [400] {'date': 'Thu, 09 Apr 2015 00:35:30 GMT', 'content-length': '65', 'content-type': 'application/json; charset=UTF-8', 'x-compute-request-id': 'req-39a96150-b9ab-4753-8b02-d5730492b288', 'x-openstack-request-id': 'req-39a96150-b9ab-4753-8b02-d5730492b288'}
RESP BODY: {"badRequest": {"message": "Malformed request url", "code": 400}}
ERROR: openstack Malformed request url (HTTP 400) (Request-ID: req-39a96150-b9ab-4753-8b02-d5730492b288)
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/cliff/app.py", line 280, in run_subcommand
result = cmd.run(parsed_args)
File "/usr/lib/python2.7/site-packages/cliff/display.py", line 91, in run
column_names, data = self.take_action(parsed_args)
File "/usr/lib/python2.7/site-packages/openstackclient/volume/v1/volume.py", line 255, in take_action
data = volume_client.volumes.list(search_opts=search_opts)
File "/usr/lib/python2.7/site-packages/cinderclient/v1/volumes.py", line 220, in list
"volumes")
File "/usr/lib/python2.7/site-packages/cinderclient/base.py", line 70, in _list
resp, body = self.api.client.get(url)
File "/usr/lib/python2.7/site-packages/cinderclient/client.py", line 302, in get
return self._cs_request(url, 'GET', **kwargs)
File "/usr/lib/python2.7/site-packages/cinderclient/client.py", line 269, in _cs_request
**kwargs)
File "/usr/lib/python2.7/site-packages/cinderclient/client.py", line 252, in request
raise exceptions.from_response(resp, body)
BadRequest: Malformed request url (HTTP 400) (Request-ID: req-39a96150-b9ab-4753-8b02-d5730492b288) |
When using keystone V3 authentication for cinder and nova (see comment #3), I got error "BadRequest: Malformed request url (HTTP 400)".
I am testing on Juno release, my keystone v3 env is like this,
export OS_USERNAME="admin"
export OS_PASSWORD="password"
export OS_DOMAIN_NAME=default
export OS_AUTH_URL="http://$MY_HOST:35357/v3"
export OS_IDENTITY_API_VERSION=3
My endpoint of cinder public URL is like http://**.**.**.**:8776/v1/cbe4b1d87fbb4318be379a79a570b7ec (I hided the real IP)
When run command "openstack --debug volume list" or "openstack --debug volume create --size 1 jin", I got this BadRequest error. From debug info, this error comes from cinder server. I added log in cinder/api/openstack/wsgi.py function _process_stack(), found the context.project_id is None while project_id has a value, here return the error.
if (context and project_id and (project_id != context.project_id)):
msg = _("Malformed request url")
return Fault(webob.exc.HTTPBadRequest(explanation=msg))
I compared with another keystone V2 authentication server, the context.project_id is same as project_id. Maybe this is difference, in v2 server the REQ has one more Project-id like "curl -i -H "X-Auth-Project-Id: admin".
I found the cinder.context maybe come from cinder/api/middleware/auth.py, the project_id in cinder.context may not be assigned a value in keystone v3 authentication scenario.
ERROR log is as below:
REQ: curl -i http://**.**.**.**:8776/v1/cbe4b1d87fbb4318be379a79a570b7ec/volumes/detail -X GET -H "User-Agent: python-cinderclient" -H "Accept: application/json" -H "X-Auth-Token: e883e05a887144d4ae70151c976ce666"
INFO: requests.packages.urllib3.connectionpool Starting new HTTP connection (1): **.**.**.**
DEBUG: requests.packages.urllib3.connectionpool "GET /v1/cbe4b1d87fbb4318be379a79a570b7ec/volumes/detail HTTP/1.1" 400 65
DEBUG: cinderclient.client RESP: [400] {'date': 'Thu, 09 Apr 2015 00:35:30 GMT', 'content-length': '65', 'content-type': 'application/json; charset=UTF-8', 'x-compute-request-id': 'req-39a96150-b9ab-4753-8b02-d5730492b288', 'x-openstack-request-id': 'req-39a96150-b9ab-4753-8b02-d5730492b288'}
RESP BODY: {"badRequest": {"message": "Malformed request url", "code": 400}}
ERROR: openstack Malformed request url (HTTP 400) (Request-ID: req-39a96150-b9ab-4753-8b02-d5730492b288)
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/cliff/app.py", line 280, in run_subcommand
result = cmd.run(parsed_args)
File "/usr/lib/python2.7/site-packages/cliff/display.py", line 91, in run
column_names, data = self.take_action(parsed_args)
File "/usr/lib/python2.7/site-packages/openstackclient/volume/v1/volume.py", line 255, in take_action
data = volume_client.volumes.list(search_opts=search_opts)
File "/usr/lib/python2.7/site-packages/cinderclient/v1/volumes.py", line 220, in list
"volumes")
File "/usr/lib/python2.7/site-packages/cinderclient/base.py", line 70, in _list
resp, body = self.api.client.get(url)
File "/usr/lib/python2.7/site-packages/cinderclient/client.py", line 302, in get
return self._cs_request(url, 'GET', **kwargs)
File "/usr/lib/python2.7/site-packages/cinderclient/client.py", line 269, in _cs_request
**kwargs)
File "/usr/lib/python2.7/site-packages/cinderclient/client.py", line 252, in request
raise exceptions.from_response(resp, body)
BadRequest: Malformed request url (HTTP 400) (Request-ID: req-39a96150-b9ab-4753-8b02-d5730492b288) |
|