** Description changed: - The following error is reported when creating a volume snapshot with - non-ascii display-description, e.g. cinder snapshot-create --display- - description "中文" my-2nd-volume. + [Impact] + + * Cinder snapshot display-description cannot contain non-ascii + characters. + + [Test Case] + + * cinder create 1 + * cinder snapshot-create --display-description "中文" <the volume ID> + + [Regression Potential] + + * None + + + The following error is reported when creating a volume snapshot with non-ascii display-description, e.g. cinder snapshot-create --display-description "中文" my-2nd-volume. 2015-11-09 05:55:50.995 29937 ERROR oslo_messaging.rpc.dispatcher [req-81f48a02-b1ef-4aae-9e22-ac2ce1c75b2f 16818cbff07548889da69bf526558d97 7aac0111a39741f59513c05b2d83dd70 - - -] Exception during message handling: 'ascii' codec can't encode characters in position 111-117: ordinal not in range(128) 2015-11-09 05:55:50.995 29937 ERROR oslo_messaging.rpc.dispatcher Traceback (most recent call last): 2015-11-09 05:55:50.995 29937 ERROR oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 142, in _dispatch_and_reply 2015-11-09 05:55:50.995 29937 ERROR oslo_messaging.rpc.dispatcher executor_callback)) 2015-11-09 05:55:50.995 29937 ERROR oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 186, in _dispatch 2015-11-09 05:55:50.995 29937 ERROR oslo_messaging.rpc.dispatcher executor_callback) 2015-11-09 05:55:50.995 29937 ERROR oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 129, in _do_dispatch 2015-11-09 05:55:50.995 29937 ERROR oslo_messaging.rpc.dispatcher result = func(ctxt, **new_args) 2015-11-09 05:55:50.995 29937 ERROR oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/dist-packages/osprofiler/profiler.py", line 102, in wrapper 2015-11-09 05:55:50.995 29937 ERROR oslo_messaging.rpc.dispatcher info["function"]["kwargs"] = str(kwargs) 2015-11-09 05:55:50.995 29937 ERROR oslo_messaging.rpc.dispatcher UnicodeEncodeError: 'ascii' codec can't encode characters in position 111-117: ordinal not in range(128) 2015-11-09 05:55:50.995 29937 ERROR oslo_messaging.rpc.dispatcher Root cause is that profiler tries to get a string representation of the arguments (cinder.objects.snapshot.Snapshot) of the snapshot-create cinder-volume service api. As a result, VersionedObject.__repr__ is called to produce such a string representation with an attribute (display-description) containing non-ascii characters, thus returning an unicode object. However when __repr__ returns an unicode object, it's expected that the the returned string can be encoded by default encoding scheme which is ascii in general [1][2]. So __repr__ needs to make sure any unicode string it's going to return are properly encoded. [1] trying to encode the returned string when it's an unicode object https://github.com/python/cpython/blob/2.7/Objects/object.c#L387 [2] if encoding arg is left null, default encoding will be used https://github.com/python/cpython/blob/2.7/Objects/unicodeobject.c#L1355
** Also affects: cinder (Ubuntu) Importance: Undecided Status: New ** Changed in: cinder (Ubuntu) Status: New => In Progress ** Changed in: cinder (Ubuntu) Assignee: (unassigned) => Liang Chen (cbjchen) -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1514325 Title: VersionedObject.__repr__ should return encoded string To manage notifications about this bug go to: https://bugs.launchpad.net/cinder/+bug/1514325/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs