Eventually, I notice that x-auth-token parameter in glance request http header is still a unicode string. No error will occur after change it to a plain string.
>>> "\r\n".join(['PUT /v1/images/ffec0090-a529-4e5a-8a8d-603a1828105a >>> HTTP/1.1', 'Host: 10.104.0.154:9292', 'Accept-Encoding: gzip, deflate', >>> 'x-image-meta-container_format: bare', 'Transfer-Encoding: chunked', >>> 'x-glance-registry-purge-props: false', 'Accept: */*', 'User-Agent: >>> python-glanceclient', 'x-image-meta-property-ramdisk_id: ', >>> 'x-image-meta-size: 14286848', 'x-image-meta-property-image_state: >>> available', 'x-image-meta-property-image_location: snapshot', >>> 'x-image-meta-is_public: False', 'x-image-meta-property-kernel_id: ', >>> u'X-Auth-Token: 07d817bf434054b6cbbe7609e007db31', 'Content-Type: >>> application/octet-stream', 'x-image-meta-property-owner_id: >>> ec96e8cac5d14d6d965e45e9071b013e', 'x-image-meta-disk_format: qcow2', >>> 'x-image-meta-name: >>> snapshot-\xef\xbc\xa1\xef\xbc\xa2\xef\xbc\xa3\xe4\xb8\x80\xe4\xb8\x81\xe4\xb8\x83\xc3\x87\xc3\xa0\xc3\xa2\xef\xbd\xb1\xef\xbd\xb2\xef\xbd\xb3\xd0\x94\xd1\x84\xd1\x8d\xd8\xa8\xd8\xaa\xd8\xab\xe0\xa4\x85\xe0\xa4\x87\xe0\xa4\x89\xe2\x82\xac\xc2\xa5\xe5\x99\x82\xe3\x82\xbd\xe5\x8d\x81\xe8\xb1\xb9\xe7\xab\xb9\xe6\x95\xb7', >>> '', '']) Traceback (most recent call last): File "<stdin>", line 1, in <module> UnicodeDecodeError: 'ascii' codec can't decode byte 0xef in position 28: ordinal not in range(128) >>> "\r\n".join(['PUT /v1/images/ffec0090-a529-4e5a-8a8d-603a1828105a >>> HTTP/1.1', 'Host: 10.104.0.154:9292', 'Accept-Encoding: gzip, deflate', >>> 'x-image-meta-container_format: bare', 'Transfer-Encoding: chunked', >>> 'x-glance-registry-purge-props: false', 'Accept: */*', 'User-Agent: >>> python-glanceclient', 'x-image-meta-property-ramdisk_id: ', >>> 'x-image-meta-size: 14286848', 'x-image-meta-property-image_state: >>> available', 'x-image-meta-property-image_location: snapshot', >>> 'x-image-meta-is_public: False', 'x-image-meta-property-kernel_id: ', >>> 'X-Auth-Token: 07d817bf434054b6cbbe7609e007db31', 'Content-Type: >>> application/octet-stream', 'x-image-meta-property-owner_id: >>> ec96e8cac5d14d6d965e45e9071b013e', 'x-image-meta-disk_format: qcow2', >>> 'x-image-meta-name: >>> snapshot-\xef\xbc\xa1\xef\xbc\xa2\xef\xbc\xa3\xe4\xb8\x80\xe4\xb8\x81\xe4\xb8\x83\xc3\x87\xc3\xa0\xc3\xa2\xef\xbd\xb1\xef\xbd\xb2\xef\xbd\xb3\xd0\x94\xd1\x84\xd1\x8d\xd8\xa8\xd8\xaa\xd8\xab\xe0\xa4\x85\xe0\xa4\x87\xe0\xa4\x89\xe2\x82\xac\xc2\xa5\xe5\x99\x82\xe3\x82\xbd\xe5\x8d\x81\xe8\xb1\xb9\xe7\xab\xb9\xe6\x95\xb7', >>> '', '']) 'PUT /v1/images/ffec0090-a529-4e5a-8a8d-603a1828105a HTTP/1.1\r\nHost: 10.104.0.154:9292\r\nAccept-Encoding: gzip, deflate\r\nx-image-meta-container_format: bare\r\nTransfer-Encoding: chunked\r\nx-glance-registry-purge-props: false\r\nAccept: */*\r\nUser-Agent: python-glanceclient\r\nx-image-meta-property-ramdisk_id: \r\nx-image-meta-size: 14286848\r\nx-image-meta-property-image_state: available\r\nx-image-meta-property-image_location: snapshot\r\nx-image-meta-is_public: False\r\nx-image-meta-property-kernel_id: \r\nX-Auth-Token: 07d817bf434054b6cbbe7609e007db31\r\nContent-Type: application/octet-stream\r\nx-image-meta-property-owner_id: ec96e8cac5d14d6d965e45e9071b013e\r\nx-image-meta-disk_format: qcow2\r\nx-image-meta-name: snapshot-\xef\xbc\xa1\xef\xbc\xa2\xef\xbc\xa3\xe4\xb8\x80\xe4\xb8\x81\xe4\xb8\x83\xc3\x87\xc3\xa0\xc3\xa2\xef\xbd\xb1\xef\xbd\xb2\xef\xbd\xb3\xd0\x94\xd1\x84\xd1\x8d\xd8\xa8\xd8\xaa\xd8\xab\xe0\xa4\x85\xe0\xa4\x87\xe0\xa4\x89\xe2\x82\xac\xc2\xa5\xe5\x99\x82\xe3\x82\xbd\xe5\x8d\x81\xe8\xb1\xb9\xe7\xab\xb9\xe6\x95\xb7\r\n\r\n' ** Project changed: nova => python-glanceclient -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to OpenStack Compute (nova). https://bugs.launchpad.net/bugs/1387327 Title: Fail to create VM snapshot with unicode snapshot name Status in Python client library for Glance: New Bug description: When I attempt to create a VM snapshot via Horizon UI, I name this new snapshot a unicode name (snapshot-ABC一丁七ÇàâアイウДфэبتثअइउ€¥噂ソ十豹竹敷). Then the snapshot operation failed in nova-compute process. The stack trace is: 2014-10-29 16:11:26.077 3551 ERROR oslo.messaging.rpc.dispatcher [req-16611064-fded-4ba1-b981-125270b0540b ] Exception during message handling: 'ascii' codec can't decode byte 0xef in position 28: ordinal not in range(128) 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher Traceback (most recent call last): 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.6/site-packages/oslo/messaging/rpc/dispatcher.py", line 134, in _dispatch_and_reply 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher incoming.message)) 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.6/site-packages/oslo/messaging/rpc/dispatcher.py", line 177, in _dispatch 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher return self._do_dispatch(endpoint, method, ctxt, args) 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.6/site-packages/oslo/messaging/rpc/dispatcher.py", line 123, in _do_dispatch 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher result = getattr(endpoint, method)(ctxt, **new_args) 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.6/site-packages/nova/exception.py", line 88, in wrapped 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher payload) 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.6/site-packages/nova/openstack/common/excutils.py", line 82, in __exit__ 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher six.reraise(self.type_, self.value, self.tb) 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.6/site-packages/nova/exception.py", line 71, in wrapped 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher return f(self, context, *args, **kw) 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.6/site-packages/nova/compute/manager.py", line 302, in decorated_function 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher pass 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.6/site-packages/nova/openstack/common/excutils.py", line 82, in __exit__ 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher six.reraise(self.type_, self.value, self.tb) 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.6/site-packages/nova/compute/manager.py", line 288, in decorated_function 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher return function(self, context, *args, **kwargs) 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.6/site-packages/nova/compute/manager.py", line 330, in decorated_function 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher kwargs['instance'], e, sys.exc_info()) 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.6/site-packages/nova/openstack/common/excutils.py", line 82, in __exit__ 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher six.reraise(self.type_, self.value, self.tb) 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.6/site-packages/nova/compute/manager.py", line 318, in decorated_function 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher return function(self, context, *args, **kwargs) 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.6/site-packages/nova/compute/manager.py", line 378, in decorated_function 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher instance=instance) 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.6/site-packages/nova/openstack/common/excutils.py", line 82, in __exit__ 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher six.reraise(self.type_, self.value, self.tb) 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.6/site-packages/nova/compute/manager.py", line 368, in decorated_function 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher *args, **kwargs) 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.6/site-packages/nova/compute/manager.py", line 3071, in snapshot_instance 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher task_states.IMAGE_SNAPSHOT) 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.6/site-packages/nova/compute/manager.py", line 3106, in _snapshot_instance 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher update_task_state) 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.6/site-packages/nova/virt/libvirt/driver.py", line 1752, in snapshot 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher image_file) 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.6/site-packages/nova/image/api.py", line 126, in update 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher purge_props=purge_props) 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.6/site-packages/nova/image/glance.py", line 405, in update 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher _reraise_translated_image_exception(image_id) 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.6/site-packages/nova/image/glance.py", line 403, in update 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher image_id, **image_meta) 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.6/site-packages/nova/image/glance.py", line 232, in call 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher return getattr(client.images, method)(*args, **kwargs) 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.6/site-packages/glanceclient/v1/images.py", line 329, in update 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher resp, body = self.client.put(url, headers=hdrs, data=image_data) 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.6/site-packages/glanceclient/common/http.py", line 259, in put 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher return self._request('PUT', url, **kwargs) 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.6/site-packages/glanceclient/common/http.py", line 200, in _request 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher **kwargs) 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.6/site-packages/requests/sessions.py", line 456, in request 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher resp = self.send(prep, **send_kwargs) 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.6/site-packages/requests/sessions.py", line 559, in send 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher r = adapter.send(request, **kwargs) 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib/python2.6/site-packages/requests/adapters.py", line 345, in send 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher low_conn.endheaders() 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib64/python2.6/httplib.py", line 908, in endheaders 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher self._send_output() 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib64/python2.6/httplib.py", line 778, in _send_output 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher msg = "\r\n".join(self._buffer) 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher UnicodeDecodeError: 'ascii' codec can't decode byte 0xef in position 28: ordinal not in range(128) 2014-10-29 16:11:26.077 3551 TRACE oslo.messaging.rpc.dispatcher 2014-10-29 16:11:26.155 3551 ERROR oslo.messaging._drivers.common [req-16611064-fded-4ba1-b981-125270b0540b ] Returning exception 'ascii' codec can't decode byte 0xef in position 28: ordinal not in range(128) to caller To manage notifications about this bug go to: https://bugs.launchpad.net/python-glanceclient/+bug/1387327/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : yahoo-eng-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp