[gnuoy,r=james-page] Fixup juno for changes in backing store configuration
This commit is contained in:
commit
ecab8f7be2
@ -50,6 +50,22 @@ class ObjectStoreContext(OSContextGenerator):
|
||||
}
|
||||
|
||||
|
||||
class MultiStoreContext(OSContextGenerator):
|
||||
|
||||
def __call__(self):
|
||||
stores = ['glance.store.filesystem.Store', 'glance.store.http.Store']
|
||||
store_mapping = {
|
||||
'ceph': 'glance.store.rbd.Store',
|
||||
'object-store': 'glance.store.swift.Store',
|
||||
}
|
||||
for store_relation, store_type in store_mapping.iteritems():
|
||||
if relation_ids(store_relation):
|
||||
stores.append(store_type)
|
||||
return {
|
||||
'known_stores': ','.join(stores)
|
||||
}
|
||||
|
||||
|
||||
class HAProxyContext(OSContextGenerator):
|
||||
interfaces = ['cluster']
|
||||
|
||||
|
@ -96,7 +96,8 @@ CONFIG_FILES = OrderedDict([
|
||||
glance_contexts.HAProxyContext(),
|
||||
context.SyslogContext(),
|
||||
glance_contexts.LoggingConfigContext(),
|
||||
glance_contexts.GlanceIPv6Context()],
|
||||
glance_contexts.GlanceIPv6Context(),
|
||||
glance_contexts.MultiStoreContext()],
|
||||
'services': ['glance-api']
|
||||
}),
|
||||
(GLANCE_API_PASTE_INI, {
|
||||
|
68
templates/juno/glance-api.conf
Normal file
68
templates/juno/glance-api.conf
Normal file
@ -0,0 +1,68 @@
|
||||
[DEFAULT]
|
||||
verbose = {{ verbose }}
|
||||
use_syslog = {{ use_syslog }}
|
||||
debug = {{ debug }}
|
||||
|
||||
known_stores = {{ known_stores }}
|
||||
{% if rbd_pool -%}
|
||||
default_store = rbd
|
||||
{% elif swift_store -%}
|
||||
default_store = swift
|
||||
{% else -%}
|
||||
default_store = file
|
||||
{% endif -%}
|
||||
|
||||
bind_host = {{ bind_host }}
|
||||
|
||||
{% if ext -%}
|
||||
bind_port = {{ ext }}
|
||||
{% elif bind_port -%}
|
||||
bind_port = {{ bind_port }}
|
||||
{% else -%}
|
||||
bind_port = 9292
|
||||
{% endif -%}
|
||||
|
||||
log_file = /var/log/glance/api.log
|
||||
backlog = 4096
|
||||
|
||||
sql_idle_timeout = 3600
|
||||
workers = 1
|
||||
registry_host = {{ registry_host }}
|
||||
registry_port = 9191
|
||||
registry_client_protocol = http
|
||||
|
||||
{% include "parts/rabbitmq" %}
|
||||
|
||||
{% if rabbitmq_host or rabbitmq_hosts -%}
|
||||
notification_driver = rabbit
|
||||
{% endif -%}
|
||||
|
||||
filesystem_store_datadir = /var/lib/glance/images/
|
||||
|
||||
{% if swift_store -%}
|
||||
swift_store_auth_version = 2
|
||||
swift_store_auth_address = {{ service_protocol }}://{{ service_host }}:{{ service_port }}/v2.0/
|
||||
swift_store_user = {{ admin_tenant_name }}:{{ admin_user }}
|
||||
swift_store_key = {{ admin_password }}
|
||||
swift_store_create_container_on_put = True
|
||||
swift_store_container = glance
|
||||
swift_store_large_object_size = 5120
|
||||
swift_store_large_object_chunk_size = 200
|
||||
swift_enable_snet = False
|
||||
{% endif -%}
|
||||
|
||||
{% if rbd_pool -%}
|
||||
rbd_store_ceph_conf = /etc/ceph/ceph.conf
|
||||
rbd_store_user = {{ rbd_user }}
|
||||
rbd_store_pool = {{ rbd_pool }}
|
||||
rbd_store_chunk_size = 8
|
||||
{% endif -%}
|
||||
|
||||
delayed_delete = False
|
||||
scrub_time = 43200
|
||||
scrubber_datadir = /var/lib/glance/scrubber
|
||||
image_cache_dir = /var/lib/glance/image-cache/
|
||||
db_enforce_mysql_charset = False
|
||||
|
||||
{% include "parts/keystone" %}
|
||||
{% include "parts/section-database" %}
|
@ -41,6 +41,20 @@ class TestGlanceContexts(CharmTestCase):
|
||||
{'rbd_pool': service,
|
||||
'rbd_user': service})
|
||||
|
||||
def test_multistore(self):
|
||||
self.relation_ids.return_value = ['random_rid']
|
||||
self.assertEquals(contexts.MultiStoreContext()(),
|
||||
{'known_stores': "glance.store.filesystem.Store,"
|
||||
"glance.store.http.Store,"
|
||||
"glance.store.rbd.Store,"
|
||||
"glance.store.swift.Store"})
|
||||
|
||||
def test_multistore_defaults(self):
|
||||
self.relation_ids.return_value = []
|
||||
self.assertEquals(contexts.MultiStoreContext()(),
|
||||
{'known_stores': "glance.store.filesystem.Store,"
|
||||
"glance.store.http.Store"})
|
||||
|
||||
@patch('charmhelpers.contrib.openstack.context.config')
|
||||
@patch('charmhelpers.contrib.openstack.context.is_clustered')
|
||||
@patch('charmhelpers.contrib.openstack.context.determine_apache_port')
|
||||
|
Loading…
x
Reference in New Issue
Block a user