run "nova evacuate" command, 'can't be encoded'error

Bug #1361134 reported by YaoZheng_ZTE
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance Client
Invalid
Undecided
Unassigned
OpenStack Security Advisory
Won't Fix
Undecided
Unassigned

Bug Description

I have some trouble when run 'nova evacuate'command
details:
1.I have two hosts, host1 is controler and conpute services, host2 is only compute service
2.stop the host2's compute service
3.run 'nova evacuate'command on the host1, return error
the host1's compute log:

| created | 2014-08-17T10:41:50Z |
| fault | {"message": "<type 'NoneType'> can't be encoded", "code": 500, "details": " File \"/usr/lib/python2.7/site-packages/nova/compute/manager.py\", line 305, in decorated_function |
| | return function(self, context, *args, **kwargs) |
| | File \"/usr/lib/python2.7/site-packages/nova/compute/manager.py\", line 2498, in rebuild_instance |
| | image_meta = _get_image_meta(context, image_ref) |
| | File \"/usr/lib/python2.7/site-packages/nova/compute/manager.py\", line 432, in _get_image_meta |
| | return image_service.show(context, image_id) |
| | File \"/usr/lib/python2.7/site-packages/nova/image/glance.py\", line 270, in show |
| | image = self._client.call(context, 1, 'get', image_id) |
| | File \"/usr/lib/python2.7/site-packages/nova/image/glance.py\", line 270, in show |
| | image = self._client.call(context, 1, 'get', image_id) |
| | File \"/usr/lib/python2.7/site-packages/nova/image/glance.py\", line 209, in call |
| | return getattr(client.images, method)(*args, **kwargs) |
| | File \"/usr/lib/python2.7/site-packages/glanceclient/v1/images.py\", line 114, in get |
| | % urllib.quote(str(image_id))) |
| | File \"/usr/lib/python2.7/site-packages/glanceclient/common/http.py\", line 289, in raw_request |
| | return self._http_request(url, method, **kwargs) |
| | File \"/usr/lib/python2.7/site-packages/glanceclient/common/http.py\", line 191, in _http_request |
| | kwargs['headers'] = self.encode_headers(kwargs['headers']) |
| | File \"/usr/lib/python2.7/site-packages/glanceclient/common/http.py\", line 166, in encode_headers |
| | return dict([(to_str(h), to_str(v)) for h, v in headers.iteritems()]) |
| | File \"/usr/lib/python2.7/site-packages/glanceclient/openstack/common/strutils.py\", line 137, in safe_encode |
| | raise TypeError(\"%s can't be encoded\" % type(text)) |
| | ", "created": "2014-08-17T11:22:04Z"} |
| flavor | m1.tiny (1df8ba6d-6c91-493d-9602-219b769709f8) |
| hostId | 36ca539f1fd65bfb2a3f57ad6a6471b405f7065b5ff0f23ef0aa56a6 |
| id | 5b413785-afdc-4d9e-8649-fe3596168b30 |
| image | cirros (d9af9100-8fde-463b-aa43-25c656e464b5)

Tags: glanceclient
tags: added: glanceclient
Revision history for this message
YaoZheng_ZTE (zheng-yao1) wrote :

At present, I change the /usr/lib/python2.7/site-packages/glanceclient/openstack/common/strutils.py safe_encode function
and avoid this issue.
e.g:
def safe_encode(text, incoming=None,
                encoding='utf-8', errors='strict'):
=>
def safe_encode(text, incoming=None,
                encoding='utf-8', errors='ignore'):

"errors" from 'strict' to 'ignore'

Thierry Carrez (ttx)
information type: Private Security → Public
Thierry Carrez (ttx)
Changed in ossa:
status: New → Won't Fix
Revision history for this message
YaoZheng_ZTE (zheng-yao1) wrote :

now, the "nova evacuate" command can not run, my work cannot continue.
if community is not intend fix , how can I avoid this issue?

no longer affects: glance
Revision history for this message
Mark Washenberger (markwash) wrote :

Yao Zheng,

The previous modifications were just to redirect this bug to the correct project (python-glanceclient is the most likely culprit at this point).

It looks like somehow the _request method in glanceclient.common.http is ending up being passed a header that has None as the value. Is there any way you can reproduce this problem but edit the line right above
> headers = self.encode_headers(headers)
to print out or log the headers, and include the results here?

Changed in python-glanceclient:
status: New → Incomplete
Revision history for this message
Ian Cordasco (icordasc) wrote :

This issue has been marked incomplete for over two years. Marking it as invalid since a lot of our header coercion logic has changed for the better.

Changed in python-glanceclient:
status: Incomplete → Invalid
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.