enabling the keystone shim causes memcache error on account creation

Bug #938375 reported by Russell Sim on 2012-02-22
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Russell Sim

Bug Description

With a new account in keystone upon the first nova request a 500 is retuned. Account creation through the shim succeeds, but the actual request fails. All subsequent requests are fine.

it seems that in the _build_mc_key method there is a string join, if one of the components is unicode the whole string becomes unicode.

(nova.api.openstack): TRACE:
(nova.api.openstack): TRACE: Traceback (most recent call last):
(nova.api.openstack): TRACE: File "/usr/lib/pymodules/python2.6/nova/api/openstack/__init__.py", line 64, in __call__
(nova.api.openstack): TRACE: return req.get_response(self.application)
(nova.api.openstack): TRACE: File "/usr/lib/pymodules/python2.6/webob/request.py", line 1053, in get_response
(nova.api.openstack): TRACE: application, catch_exc_info=False)
(nova.api.openstack): TRACE: File "/usr/lib/pymodules/python2.6/webob/request.py", line 1022, in call_application
(nova.api.openstack): TRACE: app_iter = application(self.environ, start_response)
(nova.api.openstack): TRACE: File "/usr/lib/pymodules/python2.6/keystone/middleware/auth_token.py", line 212, in __call__
(nova.api.openstack): TRACE: return self._forward_request(env, start_response, proxy_headers)
(nova.api.openstack): TRACE: File "/usr/lib/pymodules/python2.6/keystone/middleware/auth_token.py", line 344, in _forward_request
(nova.api.openstack): TRACE: return self.app(env, start_response)
(nova.api.openstack): TRACE: File "/usr/lib/pymodules/python2.6/webob/dec.py", line 147, in __call__
(nova.api.openstack): TRACE: resp = self.call_func(req, *args, **self.kwargs)
(nova.api.openstack): TRACE: File "/usr/lib/pymodules/python2.6/webob/dec.py", line 208, in call_func
(nova.api.openstack): TRACE: return self.func(req, *args, **kwargs)
(nova.api.openstack): TRACE: File "/usr/lib/pymodules/python2.6/keystone/middleware/nova_auth_token.py", line 73, in __call__
(nova.api.openstack): TRACE: if user_ref.is_admin() != is_admin:
(nova.api.openstack): TRACE: File "/usr/lib/pymodules/python2.6/nova/auth/manager.py", line 134, in is_admin
(nova.api.openstack): TRACE: return AuthManager().is_admin(self)
(nova.api.openstack): TRACE: File "/usr/lib/pymodules/python2.6/nova/auth/manager.py", line 376, in is_admin
(nova.api.openstack): TRACE: if self.is_superuser(user):
(nova.api.openstack): TRACE: File "/usr/lib/pymodules/python2.6/nova/auth/manager.py", line 362, in is_superuser
(nova.api.openstack): TRACE: if self.has_role(user, role):
(nova.api.openstack): TRACE: File "/usr/lib/pymodules/python2.6/nova/auth/manager.py", line 433, in has_role
(nova.api.openstack): TRACE: None)
(nova.api.openstack): TRACE: File "/usr/lib/pymodules/python2.6/nova/auth/manager.py", line 394, in _has_role
(nova.api.openstack): TRACE: rslt = self.mc.get(mc_key)
(nova.api.openstack): TRACE: File "/usr/lib/pymodules/python2.6/memcache.py", line 698, in get
(nova.api.openstack): TRACE: check_key(key)
(nova.api.openstack): TRACE: File "/usr/lib/pymodules/python2.6/memcache.py", line 985, in check_key
(nova.api.openstack): TRACE: raise Client.MemcachedStringEncodingError, ("Keys must be str()'s, not "
(nova.api.openstack): TRACE: MemcachedStringEncodingError: Keys must be str()'s, not unicode. Convert your unicode strings using mystring.encode(charset)!
(nova.api.openstack): TRACE:

Russell Sim (russell-sim) wrote :

this affects the diablo release, i have added a fix to gerrit https://review.openstack.org/#change,4380

Fix proposed to branch: master
Review: https://review.openstack.org/4483

Changed in nova:
status: New → In Progress

Reviewed: https://review.openstack.org/4483
Committed: http://github.com/openstack/nova/commit/5a080e5b46436e82472687d370c0fd72e750baf8
Submitter: Jenkins
Branch: master

commit 5a080e5b46436e82472687d370c0fd72e750baf8
Author: Russell Sim <email address hidden>
Date: Fri Feb 24 13:50:34 2012 +1100

    fix unicode triggered failure in AuthManager

    * Always return a string from AuthManager._build_mc_key()
    * Fixes bug 938375

    Change-Id: Iffceffab8ae62830202de07e3237230dab4e5a60

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx) on 2012-02-29
Changed in nova:
milestone: none → essex-4
status: Fix Committed → Fix Released
Mark McLoughlin (markmc) on 2012-04-03
Changed in nova:
assignee: nobody → Russell Sim (russell-sim)
Thierry Carrez (ttx) on 2012-04-05
Changed in nova:
milestone: essex-4 → 2012.1
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers