Don't pass the service catalog when making glance requests

If your service catalog has too many endpoints in it, passing this in
the request to glance can result in a 400 because the header is too big.

This isn't even necessary to pass to glance since we use the auth_token
middleware.

Per bknudson: "Any service using the auth_token middleware has no use
for the x-service-catalog header. All that auth_token middleware uses is
x-auth-token. The auth_token middleware will actually strip the
x-service-catalog from the request before it sends the request on to the
rest of the pipeline, so the application will never see it."

Closes-Bug: #1482699

Change-Id: I204c6f61194bef6eba01ab0525bc80fa2e323acd
(cherry picked from commit 4fa9bc1c54)
This commit is contained in:
ZHU ZHU 2015-08-07 09:09:08 -07:00 committed by Matt Riedemann
parent 90e1eacee8
commit 9724d506bd
4 changed files with 2 additions and 7 deletions

View File

@ -113,7 +113,6 @@ def generate_identity_headers(context, status='Confirmed'):
'X-Tenant-Id': getattr(context, 'tenant', None),
'X-Roles': ','.join(context.roles),
'X-Identity-Status': status,
'X-Service-Catalog': jsonutils.dumps(context.service_catalog),
}

View File

@ -217,7 +217,6 @@ class TestCreateGlanceClient(test.NoDBTestCase):
'X-User-Id': 'fake',
'X-Roles': '',
'X-Tenant-Id': 'fake',
'X-Service-Catalog': '[]',
'X-Identity-Status': 'Confirmed'
},
'token': 'token'
@ -237,7 +236,6 @@ class TestCreateGlanceClient(test.NoDBTestCase):
'X-User-Id': 'fake',
'X-Roles': '',
'X-Tenant-Id': 'fake',
'X-Service-Catalog': '[]',
'X-Identity-Status': 'Confirmed'
},
'token': 'token'

View File

@ -65,8 +65,7 @@ class TestGlanceStore(stubs.XenAPITestBaseNoDB):
'glance_port': 123,
'glance_use_ssl': False,
'sr_path': '/fake/sr/path',
'extra_headers': {'X-Service-Catalog': '[]',
'X-Auth-Token': 'foobar',
'extra_headers': {'X-Auth-Token': 'foobar',
'X-Roles': '',
'X-Tenant-Id': 'project',
'X-User-Id': 'user',

View File

@ -282,8 +282,7 @@ class FetchVhdImageTestCase(VMUtilsTestBase):
self.session, 'call_plugin_serialized_with_retry')
func = self.session.call_plugin_serialized_with_retry(
'glance', 'download_vhd', 0, mox.IgnoreArg(), mox.IgnoreArg(),
extra_headers={'X-Service-Catalog': '[]',
'X-Auth-Token': 'auth_token',
extra_headers={'X-Auth-Token': 'auth_token',
'X-Roles': '',
'X-Tenant-Id': None,
'X-User-Id': None,