Merge "Make the rbd pool name configurable"
This commit is contained in:
commit
8bad74f767
@ -110,6 +110,11 @@ options:
|
||||
default: False
|
||||
description: |
|
||||
Optionally restrict Ceph key permissions to access pools as required.
|
||||
rbd-pool-name:
|
||||
default:
|
||||
type: string
|
||||
description: |
|
||||
Optionally specify an existing rbd pool that cinder should map to.
|
||||
worker-multiplier:
|
||||
type: float
|
||||
default:
|
||||
|
@ -111,9 +111,13 @@ class CephGlanceContext(OSContextGenerator):
|
||||
keys="key"):
|
||||
return {}
|
||||
service = service_name()
|
||||
if config('rbd-pool-name'):
|
||||
pool_name = config('rbd-pool-name')
|
||||
else:
|
||||
pool_name = service
|
||||
return {
|
||||
# pool created based on service name.
|
||||
'rbd_pool': service,
|
||||
'rbd_pool': pool_name,
|
||||
'rbd_user': service,
|
||||
'expose_image_locations': config('expose-image-locations')
|
||||
}
|
||||
|
@ -302,10 +302,14 @@ def ceph_joined():
|
||||
|
||||
def get_ceph_request():
|
||||
service = service_name()
|
||||
if config('rbd-pool-name'):
|
||||
pool_name = config('rbd-pool-name')
|
||||
else:
|
||||
pool_name = service
|
||||
rq = CephBrokerRq()
|
||||
replicas = config('ceph-osd-replication-count')
|
||||
weight = config('ceph-pool-weight')
|
||||
rq.add_op_create_pool(name=service, replica_count=replicas,
|
||||
rq.add_op_create_pool(name=pool_name, replica_count=replicas,
|
||||
weight=weight, group='images', app_name='rbd')
|
||||
if config('restrict-ceph-pools'):
|
||||
rq.add_op_request_access_to_group(
|
||||
|
@ -107,13 +107,25 @@ class TestGlanceContexts(CharmTestCase):
|
||||
self.is_relation_made.return_value = True
|
||||
service = 'glance'
|
||||
self.service_name.return_value = service
|
||||
self.config.return_value = True
|
||||
conf_dict = {
|
||||
'rbd-pool-name': None,
|
||||
'expose-image-locations': True}
|
||||
self.config.side_effect = lambda x: conf_dict[x]
|
||||
self.assertEqual(
|
||||
contexts.CephGlanceContext()(),
|
||||
{'rbd_pool': service,
|
||||
'rbd_user': service,
|
||||
'expose_image_locations': True})
|
||||
self.config.assert_called_with('expose-image-locations')
|
||||
# Check user supplied pool name:
|
||||
conf_dict = {
|
||||
'rbd-pool-name': 'mypoolname',
|
||||
'expose-image-locations': True}
|
||||
self.assertEqual(
|
||||
contexts.CephGlanceContext()(),
|
||||
{'rbd_pool': 'mypoolname',
|
||||
'rbd_user': service,
|
||||
'expose_image_locations': True})
|
||||
|
||||
def test_multistore_below_mitaka(self):
|
||||
self.os_release.return_value = 'liberty'
|
||||
|
Loading…
Reference in New Issue
Block a user