From 8a85be099e2b110b5252841f635528f85be5193d Mon Sep 17 00:00:00 2001 From: Stuart McLaren Date: Thu, 13 Jun 2013 16:25:47 +0000 Subject: [PATCH] Add swift_store_ssl_compression param Add a new glance-api.conf parameter 'swift_store_ssl_compression', which allows disabling SSL layer compression for https swift requests. This can increase performance when transferring compressed images (eg qcow2) to/from swift. Addresses bug 1190666. DocImpact. Change-Id: Ic26dba9dce5ea7e5c09fdd531746b93cec54fc5c --- doc/source/configuring.rst | 13 +++++++++++++ etc/glance-api.conf | 6 ++++++ glance/store/swift.py | 12 ++++++++++-- glance/tests/unit/test_swift_store.py | 2 +- requirements.txt | 2 +- 5 files changed, 31 insertions(+), 4 deletions(-) diff --git a/doc/source/configuring.rst b/doc/source/configuring.rst index d2c8ce3c..399ae787 100644 --- a/doc/source/configuring.rst +++ b/doc/source/configuring.rst @@ -527,6 +527,19 @@ Optional. Default: ``publicURL`` A string giving the endpoint type of the swift service endpoint to use. This setting is only used if swift_store_auth_version is ``2``. +* ``swift_store_ssl_compression`` + +Can only be specified in configuration files. + +`This option is specific to the Swift storage backend.` + +Optional. Default: True. + +If set to False, disables SSL layer compression of https swift +requests. Setting to 'False' may improve performance for images which +are already in a compressed format, eg qcow2. If set to True then +compression will be enabled (provided it is supported by the swift +proxy). Configuring the S3 Storage Backend diff --git a/etc/glance-api.conf b/etc/glance-api.conf index 6e9f3d56..33dd439a 100644 --- a/etc/glance-api.conf +++ b/etc/glance-api.conf @@ -315,6 +315,12 @@ swift_enable_snet = False # is only necessary if the tenant has multiple swift endpoints. #swift_store_region = +# If set to False, disables SSL layer compression of https swift requests. +# Setting to 'False' may improve performance for images which are already +# in a compressed format, eg qcow2. If set to True, enables SSL layer +# compression (provided it is supported by the target swift proxy). +#swift_store_ssl_compression = True + # ============ S3 Store Options ============================= # Address where the S3 authentication service lives diff --git a/glance/store/swift.py b/glance/store/swift.py index aa778dd6..d0ffa401 100644 --- a/glance/store/swift.py +++ b/glance/store/swift.py @@ -102,6 +102,11 @@ swift_opts = [ help=_('A list of tenants that will be granted read/write ' 'access on all Swift containers created by Glance in ' 'multi-tenant mode.')), + cfg.BoolOpt('swift_store_ssl_compression', default=True, + help=_('If set to False, disables SSL layer compression of ' + 'https swift requests. Setting to False may improve ' + 'performance for images which are already in a ' + 'compressed format, eg qcow2.')), ] CONF = cfg.CONF @@ -267,6 +272,7 @@ class BaseStore(glance.store.base.Store): self.endpoint_type = CONF.swift_store_endpoint_type self.snet = CONF.swift_enable_snet self.insecure = CONF.swift_store_auth_insecure + self.ssl_compression = CONF.swift_store_ssl_compression def get(self, location, connection=None): location = location.store_location @@ -574,7 +580,8 @@ class SingleTenantStore(BaseStore): return swiftclient.Connection( auth_url, user, location.key, insecure=self.insecure, tenant_name=tenant_name, snet=self.snet, - auth_version=self.auth_version, os_options=os_options) + auth_version=self.auth_version, os_options=os_options, + ssl_compression=self.ssl_compression) class MultiTenantStore(BaseStore): @@ -654,7 +661,8 @@ class MultiTenantStore(BaseStore): preauthurl=location.swift_url, preauthtoken=self.context.auth_tok, tenant_name=self.context.tenant, - auth_version='2', snet=self.snet, insecure=self.insecure) + auth_version='2', snet=self.snet, insecure=self.insecure, + ssl_compression=self.ssl_compression) class ChunkReader(object): diff --git a/glance/tests/unit/test_swift_store.py b/glance/tests/unit/test_swift_store.py index ad0f31e3..1ae907b8 100644 --- a/glance/tests/unit/test_swift_store.py +++ b/glance/tests/unit/test_swift_store.py @@ -692,7 +692,7 @@ class FakeConnection(object): def __init__(self, authurl, user, key, retries=5, preauthurl=None, preauthtoken=None, snet=False, starting_backoff=1, tenant_name=None, os_options={}, auth_version="1", - insecure=False): + insecure=False, ssl_compression=True): self.authurl = authurl self.user = user self.key = key diff --git a/requirements.txt b/requirements.txt index 6e7bc748..1c0de524 100644 --- a/requirements.txt +++ b/requirements.txt @@ -25,7 +25,7 @@ iso8601>=0.1.4 oslo.config>=1.2.0a3 # For Swift storage backend. -python-swiftclient>=1.2 +python-swiftclient>=1.5 # Note you will need gcc buildtools installed and must # have installed libxml headers for lxml to be successfully