Ensure we use the correct pool name

Change-Id: Ieaee887b03ac4e9ae880ff27e0660f9269c16c2e
Closes-Bug: #1814603
This commit is contained in:
Chris MacNaughton 2019-02-05 09:30:58 +01:00
parent 9802731e58
commit 511f2f0a19
2 changed files with 18 additions and 1 deletions

View File

@ -108,7 +108,8 @@ def get_ceph_request():
rq = CephBrokerRq()
replicas = config('ceph-osd-replication-count')
weight = config('ceph-pool-weight')
rq.add_op_create_pool(name=service, replica_count=replicas,
pool_name = config('rbd-pool-name') or service
rq.add_op_create_pool(name=pool_name, replica_count=replicas,
weight=weight,
group="volumes")
if config('restrict-ceph-pools'):

View File

@ -151,6 +151,22 @@ class TestCinderHooks(CharmTestCase):
permission='rwx'),
])
@patch('charmhelpers.contrib.storage.linux.ceph.CephBrokerRq'
'.add_op_request_access_to_group')
@patch('charmhelpers.contrib.storage.linux.ceph.CephBrokerRq'
'.add_op_create_pool')
def test_create_pool_wth_name_op(self, mock_create_pool,
mock_request_access):
self.service_name.return_value = 'cinder'
self.test_config.set('ceph-osd-replication-count', 4)
self.test_config.set('ceph-pool-weight', 20)
self.test_config.set('rbd-pool-name', 'cinder-test')
hooks.get_ceph_request()
mock_create_pool.assert_called_with(name='cinder-test',
replica_count=4,
weight=20,
group='volumes')
@patch('charmhelpers.core.hookenv.config')
def test_ceph_changed_no_keys(self, mock_config):
'''It ensures ceph assets created on ceph changed'''