summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhi Yan Liu <lzy.dev@gmail.com>2013-05-21 12:27:30 +0800
committerZhi Yan Liu <lzy.dev@gmail.com>2013-05-22 19:01:18 +0800
commit832a66cf0bd8f7ccb0878889174c1ce4da7f42f3 (patch)
treee43f1cfa205a903ffe840d67fb1b1c12f6141df3
parentdb56c590e8b0a50e0fc2ee5bf186057a66c90e2e (diff)
Using unicode() to handle image's properties
Replace str() to unicode() to allow nova-api work well with the fix I did in glanceclient (https://review.openstack.org/#/c/29245/6). Fixes: Bug #1180377 Change-Id: I31e532bb50e12e355b9dd26c9ce1e129da858cbe Signed-off-by: Zhi Yan Liu <lzy.dev@gmail.com>
-rw-r--r--nova/compute/api.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py
index 32a68280d..378269a04 100644
--- a/nova/compute/api.py
+++ b/nova/compute/api.py
@@ -932,7 +932,7 @@ class API(base.Base):
instance.setdefault('system_metadata', {})
prefix_format = SM_IMAGE_PROP_PREFIX + '%s'
for key, value in image_properties.iteritems():
- new_value = str(value)[:255]
+ new_value = unicode(value)[:255]
instance['system_metadata'][prefix_format % key] = new_value
# Keep a record of the original base image that this
@@ -1835,7 +1835,7 @@ class API(base.Base):
del sys_metadata[key]
# Add the new ones
for key, value in image.get('properties', {}).iteritems():
- new_value = str(value)[:255]
+ new_value = unicode(value)[:255]
sys_metadata[(SM_IMAGE_PROP_PREFIX + '%s') % key] = new_value
self.db.instance_system_metadata_update(context,
instance['uuid'], sys_metadata, True)