Add parameters to cinder backend configuration
Add configuration parameters cinder_store_user_name, cinder_store_password, cinder_store_project_name and cinder_store_auth_address to cinder volume type backend configuration. This avoids a glance_store bug that prevents glance-api from starting. Closes-Bug: #2052726 Change-Id: I4b6ca32ed426f77a326711c2457046dbda594e77
This commit is contained in:
parent
d9e52f7869
commit
07da644b2b
@ -33,6 +33,7 @@ from charmhelpers.contrib.openstack.context import (
|
||||
ApacheSSLContext as SSLContext,
|
||||
BindHostContext,
|
||||
VolumeAPIContext,
|
||||
IdentityServiceContext,
|
||||
)
|
||||
|
||||
from charmhelpers.contrib.hahelpers.cluster import (
|
||||
@ -367,6 +368,7 @@ class MultiBackendContext(OSContextGenerator):
|
||||
# backend cinder_volume_type should be left blank so that glance
|
||||
# creates volume in cinder without specifying any volume type.
|
||||
if cinder_volume_types:
|
||||
keystone_ctx = IdentityServiceContext()()
|
||||
for volume_type in volume_types:
|
||||
ctxt['enabled_backend_configs'][volume_type] = {
|
||||
'cinder_volume_type': volume_type,
|
||||
@ -374,6 +376,17 @@ class MultiBackendContext(OSContextGenerator):
|
||||
'cinder_state_transition_timeout': config(
|
||||
'cinder-state-transition-timeout'),
|
||||
}
|
||||
if keystone_ctx:
|
||||
ctxt['enabled_backend_configs'][volume_type].update({
|
||||
'cinder_store_user_name': keystone_ctx.get(
|
||||
'admin_user'),
|
||||
'cinder_store_password': keystone_ctx.get(
|
||||
'admin_password'),
|
||||
'cinder_store_project_name': keystone_ctx.get(
|
||||
'admin_tenant_name'),
|
||||
'cinder_store_auth_address': keystone_ctx.get(
|
||||
'keystone_authtoken').get('auth_url'),
|
||||
})
|
||||
else:
|
||||
# default cinder volume type cinder
|
||||
ctxt['enabled_backend_configs']['cinder'] = {
|
||||
|
@ -389,7 +389,9 @@ class TestGlanceContexts(CharmTestCase):
|
||||
'default_store_backend': 'cinder',
|
||||
})
|
||||
|
||||
def test_multi_backend_with_cinder_volume_types_defined(self):
|
||||
@patch('charmhelpers.contrib.openstack.'
|
||||
'context.IdentityServiceContext.__call__')
|
||||
def test_multi_backend_with_cinder_volume_types_defined(self, keystone):
|
||||
# return relation_ids only for cinder but not for swift
|
||||
def _relation_ids(*args, **kwargs):
|
||||
if args[0] == 'cinder-volume-service':
|
||||
@ -399,6 +401,12 @@ class TestGlanceContexts(CharmTestCase):
|
||||
|
||||
self.maxDiff = None
|
||||
self.relation_ids.side_effect = _relation_ids
|
||||
keystone.return_value = {
|
||||
'admin_user': 'user',
|
||||
'admin_password': 'password',
|
||||
'admin_tenant_name': 'services',
|
||||
'keystone_authtoken': {'auth_url': 'http://10.0.0.1:35357/v3'},
|
||||
}
|
||||
self.is_relation_made.return_value = False
|
||||
data_dir = '/some/data/dir'
|
||||
conf_dict = {
|
||||
@ -420,6 +428,11 @@ class TestGlanceContexts(CharmTestCase):
|
||||
'cinder_volume_type': 'volume-type-test',
|
||||
'cinder_http_retries': 3,
|
||||
'cinder_state_transition_timeout': 30,
|
||||
'cinder_store_user_name': 'user',
|
||||
'cinder_store_password': 'password',
|
||||
'cinder_store_project_name': 'services',
|
||||
'cinder_store_auth_address':
|
||||
'http://10.0.0.1:35357/v3',
|
||||
}
|
||||
},
|
||||
'enabled_backends': 'local:file, volume-type-test:cinder',
|
||||
|
Loading…
x
Reference in New Issue
Block a user