Add 'rbd-mirroring-mode' to replicated 'create-pool' broker req op

The new config option is applied only to the broker request to
create the charm replicated pool.

Co-authored-by: Marius Oprin <moprin@cloudbasesolutions.com>
Change-Id: I6bf9544af02d0622b8f714da97b5dbcf49d1d1af
This commit is contained in:
Ionut Balutoiu 2020-10-27 12:45:46 +00:00 committed by Marius
parent 5d49a71fab
commit 026233bd7c
3 changed files with 15 additions and 3 deletions

View File

@ -53,6 +53,13 @@ options:
description: |
Flatten volumes created from snapshots to remove dependency from
volume to snapshot. Supported on Queens+
rbd-mirroring-mode:
type: string
default: pool
description: |
The RBD mirroring mode used for the Ceph pool. This option is only used
with 'replicated' pool type, as it's not supported for 'erasure-coded'
pool type - valid values: 'pool' and 'image'
pool-type:
type: string
default: replicated

View File

@ -193,6 +193,7 @@ def get_ceph_request():
'weight': weight,
'group': 'volumes',
'app_name': 'rbd',
'rbd_mirroring_mode': config('rbd-mirroring-mode')
}
kwargs.update(bluestore_compression.get_kwargs())
rq.add_op_create_replicated_pool(**kwargs)

View File

@ -141,14 +141,16 @@ class TestCinderHooks(CharmTestCase):
hooks.get_ceph_request()
mock_create_pool.assert_called_with(name='cinder', replica_count=4,
weight=20, group='volumes',
app_name='rbd')
app_name='rbd',
rbd_mirroring_mode='pool')
mock_request_access.assert_not_called()
self.test_config.set('restrict-ceph-pools', True)
hooks.get_ceph_request()
mock_create_pool.assert_called_with(name='cinder', replica_count=4,
weight=20, group='volumes',
app_name='rbd')
app_name='rbd',
rbd_mirroring_mode='pool')
mock_request_access.assert_has_calls([
call(
name='volumes',
@ -181,7 +183,8 @@ class TestCinderHooks(CharmTestCase):
replica_count=4,
weight=20,
group='volumes',
app_name='rbd')
app_name='rbd',
rbd_mirroring_mode='pool')
# confirm operation with bluestore compression
mock_create_pool.reset_mock()
mock_bluestore_compression().get_kwargs.return_value = {
@ -193,6 +196,7 @@ class TestCinderHooks(CharmTestCase):
weight=20,
group='volumes',
app_name='rbd',
rbd_mirroring_mode='pool',
compression_mode='fake')
@patch.object(hooks, 'CephBlueStoreCompressionContext')