From 832a66cf0bd8f7ccb0878889174c1ce4da7f42f3 Mon Sep 17 00:00:00 2001 From: Zhi Yan Liu Date: Tue, 21 May 2013 12:27:30 +0800 Subject: 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 --- nova/compute/api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'nova') 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) -- cgit