when using memcache, nova host-list cause api exception

Bug #1212164 reported by Yaguang Tang
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
High
Yaguang Tang

Bug Description

nova host-list when using memcache

2013-08-14 09:18:57.245 TRACE nova.api.openstack File "/opt/stack/nova/nova/api/openstack/compute/contrib/hosts.py", line 143, in index
2013-08-14 09:18:57.245 TRACE nova.api.openstack set_zones=True)
2013-08-14 09:18:57.245 TRACE nova.api.openstack File "/opt/stack/nova/nova/compute/api.py", line 2900, in service_get_all
2013-08-14 09:18:57.245 TRACE nova.api.openstack services)
2013-08-14 09:18:57.245 TRACE nova.api.openstack File "/opt/stack/nova/nova/availability_zones.py", line 77, in set_availability_zones
2013-08-14 09:18:57.245 TRACE nova.api.openstack cache.delete(cache_key)
2013-08-14 09:18:57.245 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/memcache.py", line 421, in delete
2013-08-14 09:18:57.245 TRACE nova.api.openstack self.check_key(key)
2013-08-14 09:18:57.245 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/memcache.py", line 1014, in check_key
2013-08-14 09:18:57.245 TRACE nova.api.openstack "Keys must be str()'s, not unicode. Convert your unicode "
2013-08-14 09:18:57.245 TRACE nova.api.openstack MemcachedStringEncodingError: Keys must be str()'s, not unicode. Convert your unicode strings using mystring.encode(charset)!
2013-08-14 09:18:57.245 TRACE nova.api.openstack

fix should be something like this

diff --git a/nova/availability_zones.py b/nova/availability_zones.py
index d627fa0..869ad87 100644
--- a/nova/availability_zones.py
+++ b/nova/availability_zones.py
@@ -56,7 +56,7 @@ def _reset_cache():

 def _make_cache_key(host):
- return "azcache-%s" % host
+ return "azcache-%s" % str(host)

Tags: api
Yaguang Tang (heut2008)
Changed in nova:
assignee: nobody → Yaguang Tang (heut2008)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

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

melanie witt (melwitt)
tags: added: api
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/41873
Committed: http://github.com/openstack/nova/commit/6e047e0b87d2caffe9d60c305f7ba4dcb17d8167
Submitter: Jenkins
Branch: master

commit 6e047e0b87d2caffe9d60c305f7ba4dcb17d8167
Author: Yaguang Tang <email address hidden>
Date: Wed Aug 14 17:23:12 2013 +0800

    Fix unicode key of azcache can't be stored to memcache

    The memcache library we are using assumes all strings passed to
    it are plain ascii, so we need to convert unicode to string.

    Fix bug #1212164

    Change-Id: Ibf36e6b096893cb9f056371bb43cbb441cae6e32

Changed in nova:
importance: Undecided → High
tags: added: grizzly-backport-potential
David Ripton (dripton)
Changed in nova:
status: New → Triaged
status: Triaged → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
Alan Pevec (apevec)
tags: removed: grizzly-backport-potential
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.