swift as glance backend (#2)
* Add swift to mitaka glance configuration
* Revert "Add swift to mitaka glance configuration"
This reverts commit 4fdd899db23cdb9e26c158b74397ede79495a136.
* Added swift configuration to formula
* Update configuration with new variables and defaults
* Adding a swift test example with lots of configuration options.
* Add sample for swift in README
* remove empty else.
* Adding endif for if 'swift' in storage_engines.
* Update variable naming scheme to use swift.store instead of swift_store
diff --git a/README.rst b/README.rst
index eafd56a..2a2693f 100644
--- a/README.rst
+++ b/README.rst
@@ -138,6 +138,28 @@
map_file: '/etc/pycadf/glance_api_audit_map.conf'
....
+Swift integration glance
+
+.. code-block:: yaml
+
+ glance:
+ server:
+ enabled: true
+ version: mitaka
+ storage:
+ engine: swift,http
+ swift:
+ store:
+ auth:
+ address: http://keystone.example.com:5000/v2.0
+ version: 2
+ endpoint_type: publicURL
+ container: glance
+ create_container_on_put: true
+ retry_get_count: 5
+ user: 2ec7966596504f59acc3a76b3b9d9291:glance-user
+ key: someRandomPassword
+
Client role
-----------
diff --git a/glance/files/mitaka/glance-api.conf.Debian b/glance/files/mitaka/glance-api.conf.Debian
index da46f21..9254fca 100644
--- a/glance/files/mitaka/glance-api.conf.Debian
+++ b/glance/files/mitaka/glance-api.conf.Debian
@@ -803,55 +803,80 @@
# (dict value)
#http_proxy_information =
+{%- if 'swift' in storage_engines %}
+
# If True, swiftclient won't check for a valid SSL certificate when
# authenticating. (boolean value)
#swift_store_auth_insecure = false
+swift_store_auth_insecure = {{ server.storage.swift.store.auth.get('insecure', False)|lower }}
# A string giving the CA certificate file to use in SSL connections
# for verifying certs. (string value)
#swift_store_cacert = <None>
+{% if server.storage.swift.store.cacert is defined %}
+swift_store_cacert = {{ server.storage.swift.store.cacert }}
+{% endif %}
# The region of the swift endpoint to be used for single tenant. This
# setting is only necessary if the tenant has multiple swift
# endpoints. (string value)
#swift_store_region = <None>
+{% if server.storage.swift.store.region is defined %}
+swift_store_region = {{ server.storage.swift.store.region }}
+{% endif %}
# If set, the configured endpoint will be used. If None, the storage
# url from the auth response will be used. (string value)
#swift_store_endpoint = <None>
+{% if server.storage.swift.store.endpoint is defined %}
+swift_store_endpoint = {{ server.storage.swift.store.endpoint }}
+{% endif %}
# A string giving the endpoint type of the swift service to use
# (publicURL, adminURL or internalURL). This setting is only used if
# swift_store_auth_version is 2. (string value)
-swift_store_endpoint_type = {{ server.identity.get('endpoint_type', 'publicURL') }}
+#swift_store_endpoint_type = publicURL
+swift_store_endpoint_type = {{ server.storage.swift.store.get('endpoint_type', server.identity.get('endpoint_type', 'publicURL')) }}
# A string giving the service type of the swift service to use. This
# setting is only used if swift_store_auth_version is 2. (string
# value)
#swift_store_service_type = object-store
+{% if server.storage.swift.store.service_type is defined %}
+swift_store_service_type = {{ server.storage.swift.store.service_type }}
+{% endif %}
# Container within the account that the account should use for storing
# images in Swift when using single container mode. In multiple
# container mode, this will be the prefix for all containers. (string
# value)
#swift_store_container = glance
+swift_store_container = {{ server.storage.swift.store.get('container', 'glance') }}
# The size, in MB, that Glance will start chunking image files and do
# a large object manifest in Swift. (integer value)
#swift_store_large_object_size = 5120
+{% if server.storage.swift.store.large_object_size is defined %}
+swift_store_large_object_size = {{ server.storage.swift.store.large_object_size }}
+{% endif %}
# The amount of data written to a temporary disk buffer during the
# process of chunking the image file. (integer value)
#swift_store_large_object_chunk_size = 200
+{% if server.storage.swift.store.large_object_chunk_size is defined %}
+swift_store_large_object_chunk_size = {{ server.storage.swift.store.large_object_chunk_size }}
+{% endif %}
# A boolean value that determines if we create the container if it
# does not exist. (boolean value)
#swift_store_create_container_on_put = false
+swift_store_create_container_on_put = {{ server.storage.swift.store.get('create_container_on_put', False)|lower }}
# If set to True, enables multi-tenant storage mode which causes
# Glance images to be stored in tenant specific Swift accounts.
# (boolean value)
#swift_store_multi_tenant = false
+swift_store_multi_tenant = {{ server.storage.swift.store.get('multi_tenant', False)|lower }}
# When set to 0, a single-tenant store will only use one container to
# store all images. When set to an integer value between 1 and 32, a
@@ -862,26 +887,37 @@
# option is set to 2, then 16^2=256 containers will be used to store
# images. (integer value)
#swift_store_multiple_containers_seed = 0
+swift_store_multiple_containers_seed = {{ server.storage.swift.store.get('multiple_containers_seed', 0) }}
# A list of tenants that will be granted read/write access on all
# Swift containers created by Glance in multi-tenant mode. (list
# value)
#swift_store_admin_tenants =
+{% if server.storage.swift.store.admin_tenants is defined %}
+swift_store_admin_tenants = {{ server.storage.swift.store.admin_tenants }}
+{% endif %}
# 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. (boolean value)
#swift_store_ssl_compression = true
+swift_store_ssl_compression = {{ server.storage.swift.store.get('ssl_compression', True)|lower }}
# The number of times a Swift download will be retried before the
# request fails. (integer value)
#swift_store_retry_get_count = 0
+{% if server.storage.swift.store.retry_get_count is defined %}
+swift_store_retry_get_count = {{ server.storage.swift.store.retry_get_count }}
+{% endif %}
# The period of time (in seconds) before token expirationwhen
# glance_store will try to reques new user token. Default value 60 sec
# means that if token is going to expire in 1 min then glance_store
# request new user token. (integer value)
#swift_store_expire_soon_interval = 60
+{% if server.storage.swift.store.expire_soon_interval is defined %}
+swift_store_expire_soon_interval = {{ server.storage.swift.store.expire_soon_interval }}
+{% endif %}
# If set to True create a trust for each add/get request to Multi-
# tenant store in order to prevent authentication token to be expired
@@ -890,33 +926,48 @@
# Please note that this option is considered only and only if
# swift_store_multi_tenant=True (boolean value)
#swift_store_use_trusts = true
+{% if server.storage.swift.store.use_trusts is defined %}
+swift_store_use_trusts = {{ server.storage.swift.store.use_trusts|lower }}
+{% endif %}
# The reference to the default swift account/backing store parameters
# to use for adding new images. (string value)
#default_swift_reference = ref1
+{% if server.storage.swift.store.default_swift_reference is defined %}
+default_swift_reference = {{ server.storage.swift.store.default_swift_reference }}
+{% endif %}
# Version of the authentication service to use. Valid versions are 2
# and 3 for keystone and 1 (deprecated) for swauth and rackspace.
# (deprecated - use "auth_version" in swift_store_config_file) (string
# value)
#swift_store_auth_version = 2
+swift_store_auth_version = {{ server.storage.swift.store.auth.version }}
# The address where the Swift authentication service is listening.
# (deprecated - use "auth_address" in swift_store_config_file) (string
# value)
#swift_store_auth_address = <None>
+swift_store_auth_address = {{ server.storage.swift.store.auth.address }}
# The user to authenticate against the Swift authentication service
# (deprecated - use "user" in swift_store_config_file) (string value)
#swift_store_user = <None>
+swift_store_user = {{ server.storage.swift.store.user }}
# Auth key for the user authenticating against the Swift
# authentication service. (deprecated - use "key" in
# swift_store_config_file) (string value)
#swift_store_key = <None>
+swift_store_key = {{ server.storage.swift.store.key }}
# The config file that has the swift account(s)configs. (string value)
#swift_store_config_file = <None>
+{% if server.storage.swift.store.config_file is defined %}
+swift_store_config_file = {{ server.storage.swift.store.config_file }}
+{% endif %}
+
+{% endif %}
{%- if 'rbd' in storage_engines %}
# RADOS images will be chunked into objects of this size (in
diff --git a/tests/pillar/single_swift.sls b/tests/pillar/single_swift.sls
new file mode 100644
index 0000000..97d4fdd
--- /dev/null
+++ b/tests/pillar/single_swift.sls
@@ -0,0 +1,61 @@
+glance:
+ server:
+ enabled: true
+ version: liberty
+ workers: 1
+ database:
+ engine: mysql
+ host: localhost
+ port: 3306
+ name: glance
+ user: glance
+ password: password
+ registry:
+ host: 127.0.0.1
+ port: 9191
+ bind:
+ address: 127.0.0.1
+ port: 9292
+ identity:
+ engine: keystone
+ host: 127.0.0.1
+ port: 35357
+ user: glance
+ password: password
+ region: RegionOne
+ tenant: service
+ endpoint_type: internalURL
+ message_queue:
+ engine: rabbitmq
+ host: 127.0.0.1
+ port: 5672
+ user: openstack
+ password: password
+ virtual_host: '/openstack'
+ storage:
+ engine: swift
+ swift:
+ store:
+ # admin_tenants:
+ auth:
+ address: http://127.0.0.1:5000/v2.0
+ insecure: false
+ version: 2
+ cacert: /etc/ssl/certs/ca-certificates.crt
+ # config_file:
+ container: glance
+ create_container_on_put: true
+ endpoint: swift
+ endpoint_type: internalURL
+ expire_soon_interval: 60
+ key: someRandomPassword
+ large_object_size: 5120
+ large_object_chunk_size: 200
+ multi_tenant: false
+ multiple_containers_seed: 0
+ retry_get_count: 5
+ region: RegionOne
+ service_type: object-store
+ ssl_compression: false
+ use_trusts: false
+ user: 2ec7966596504f59acc3a76b3b9d9291:glance-user