From 77d33a33d662ab5ae85265f5f9c9968dc8fa8e5b Mon Sep 17 00:00:00 2001 From: ZHU ZHU Date: Fri, 7 Aug 2015 09:09:08 -0700 Subject: 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." Conflicts: nova/tests/unit/image/test_glance.py nova/tests/unit/virt/xenapi/image/test_glance.py nova/tests/unit/virt/xenapi/test_vm_utils.py NOTE(mriedem): The conflicts in the tests are due to the test modules all being moved in kilo, otherwise there are no differences. Closes-Bug: #1482699 Change-Id: I204c6f61194bef6eba01ab0525bc80fa2e323acd (cherry picked from commit 4fa9bc1c544af30f167499284fc3e8ff6b65d23f) (cherry picked from commit 9724d506bd9c478b757874b1de80f4e9fb7d7743) --- nova/image/glance.py | 1 - nova/tests/image/test_glance.py | 2 -- nova/tests/virt/xenapi/image/test_glance.py | 3 +-- nova/tests/virt/xenapi/test_vm_utils.py | 3 +-- 4 files changed, 2 insertions(+), 7 deletions(-) diff --git a/nova/image/glance.py b/nova/image/glance.py index 98df2106f8..773cc8fe77 100644 --- a/nova/image/glance.py +++ b/nova/image/glance.py @@ -126,7 +126,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), } diff --git a/nova/tests/image/test_glance.py b/nova/tests/image/test_glance.py index 675774153a..5dd16ed2a9 100644 --- a/nova/tests/image/test_glance.py +++ b/nova/tests/image/test_glance.py @@ -218,7 +218,6 @@ class TestCreateGlanceClient(test.NoDBTestCase): 'X-User-Id': 'fake', 'X-Roles': '', 'X-Tenant-Id': 'fake', - 'X-Service-Catalog': '[]', 'X-Identity-Status': 'Confirmed' }, 'token': 'token' @@ -238,7 +237,6 @@ class TestCreateGlanceClient(test.NoDBTestCase): 'X-User-Id': 'fake', 'X-Roles': '', 'X-Tenant-Id': 'fake', - 'X-Service-Catalog': '[]', 'X-Identity-Status': 'Confirmed' }, 'token': 'token' diff --git a/nova/tests/virt/xenapi/image/test_glance.py b/nova/tests/virt/xenapi/image/test_glance.py index 60486ace6d..ea851339e1 100644 --- a/nova/tests/virt/xenapi/image/test_glance.py +++ b/nova/tests/virt/xenapi/image/test_glance.py @@ -63,8 +63,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', diff --git a/nova/tests/virt/xenapi/test_vm_utils.py b/nova/tests/virt/xenapi/test_vm_utils.py index 3e29bc65ef..0bff480bef 100644 --- a/nova/tests/virt/xenapi/test_vm_utils.py +++ b/nova/tests/virt/xenapi/test_vm_utils.py @@ -277,8 +277,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(), - 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, -- cgit v1.2.1