Comment 0 for bug 1415935

Revision history for this message
hougangliu (liuhoug) wrote :

refer to https://review.openstack.org/#/c/129289/

 if you're using Nova but don't have Nova configured with
auth_strategy='keystone' (see nova.image.glance._create_glance_client for details),
and when you resize(or other operation need call glance) an VM, it may call
glanceclient, and code may go to the logic like:
/usr/lib/python2.7/site-packages/glanceclient/v1/client.py(36)__init__()
-> self.http_client = http.HTTPClient(endpoint, *args, **kwargs)
> /usr/lib/python2.7/site-packages/glanceclient/common/http.py(57)__init__()

and in /usr/lib/python2.7/site-packages/glanceclient/common/http.py(57)__init__()
 self.identity_headers = kwargs.get('identity_headers') <<<<<<<<<<
 self.auth_token = kwargs.get('token')
and the self.identity_headers may be like:
{'X-Service-Catalog': '[]', 'X-Auth-Token': None, 'X-Roles': u'admin', 'X-Tenant-Id': None, 'X-User-Id': None, 'X-Identity-Status': 'Confirmed'}

and for https://review.openstack.org/#/c/136326/,
for the code:
        if self.identity_headers:
            for k, v in six.iteritems(self.identity_headers):
                headers.setdefault(k, v)

headers would be like: {'X-Service-Catalog': '[]', 'X-Auth-Token': None, 'X-Roles': u'admin', 'X-Tenant-Id': None, 'X-User-Id': None, 'X-Identity-Status': 'Confirmed', ....}

so "headers = self.encode_headers(headers)" in /usr/lib/python2.7/site-packages/glanceclient/common/http.py(1957)__request()
would raise TypeError("NoneType can't be encoded"), thus resize(or other operation need call glance) would fail.