From: Guillaume Abrioux Date: Fri, 28 Feb 2020 18:59:22 +0000 (+0100) Subject: osd: add journal option in ceph_volume call (batch) X-Git-Tag: v6.0.0alpha1~43 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=0326d992c2b6b92a6d4b8ccf2a51d9343652da48;p=ceph-ansible.git osd: add journal option in ceph_volume call (batch) This commit adds the journal option to the ceph_volume call when scenario is lvm batch Signed-off-by: Guillaume Abrioux --- diff --git a/library/ceph_volume.py b/library/ceph_volume.py index 9468a2012..1bdd7c7f4 100644 --- a/library/ceph_volume.py +++ b/library/ceph_volume.py @@ -277,6 +277,7 @@ def batch(module, container_image): objectstore = module.params['objectstore'] batch_devices = module.params.get('batch_devices', None) crush_device_class = module.params.get('crush_device_class', None) + journal_devices = module.params.get('journal_devices', None) journal_size = module.params.get('journal_size', None) block_db_size = module.params.get('block_db_size', None) block_db_devices = module.params.get('block_db_devices', None) @@ -319,6 +320,9 @@ def batch(module, container_image): cmd.extend(batch_devices) + if journal_devices and objectstore == 'filestore': + cmd.extend(['--journal-devices', ' '.join(journal_devices)]) + if block_db_devices and objectstore == 'bluestore': cmd.extend(['--db-devices', ' '.join(block_db_devices)]) @@ -512,6 +516,7 @@ def run_module(): batch_devices=dict(type='list', required=False, default=[]), osds_per_device=dict(type='int', required=False, default=1), journal_size=dict(type='str', required=False, default='5120'), + journal_devices=dict(type='str', required=False, default=False), block_db_size=dict(type='str', required=False, default='-1'), block_db_devices=dict(type='list', required=False, default=[]), wal_devices=dict(type='list', required=False, default=[]), diff --git a/roles/ceph-osd/tasks/scenarios/lvm-batch.yml b/roles/ceph-osd/tasks/scenarios/lvm-batch.yml index 5826af0f2..a34400e7a 100644 --- a/roles/ceph-osd/tasks/scenarios/lvm-batch.yml +++ b/roles/ceph-osd/tasks/scenarios/lvm-batch.yml @@ -12,10 +12,11 @@ block_db_size: "{{ block_db_size }}" block_db_devices: "{{ dedicated_devices | unique if dedicated_devices | length > 0 else omit }}" wal_devices: "{{ bluestore_wal_devices | unique if bluestore_wal_devices | length > 0 else omit }}" + journal_devices: "{{ dedicated_devices | unique if dedicated_devices | length > 0 else omit }}" action: "batch" environment: CEPH_VOLUME_DEBUG: 1 CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else None }}" CEPH_CONTAINER_BINARY: "{{ container_binary }}" PYTHONIOENCODING: utf-8 - when: _devices | default([]) | length > 0 \ No newline at end of file + when: _devices | default([]) | length > 0 diff --git a/tests/library/test_ceph_volume.py b/tests/library/test_ceph_volume.py index 1254c1c7a..080204550 100644 --- a/tests/library/test_ceph_volume.py +++ b/tests/library/test_ceph_volume.py @@ -344,3 +344,29 @@ class TestCephVolumeModule(object): result = ceph_volume.batch( fake_module, fake_container_image) assert result == expected_command_list + + def test_batch_filestore_with_dedicated_journal(self): + fake_module = MagicMock() + fake_module.params = {'objectstore': 'filestore', + 'journal_size': '100', + 'cluster': 'ceph', + 'batch_devices': ["/dev/sda", "/dev/sdb"], + 'journal_devices': ["/dev/sdc"]} + + fake_container_image = None + expected_command_list = ['ceph-volume', + '--cluster', + 'ceph', + 'lvm', + 'batch', + '--filestore', + '--yes', + '--journal-size', + '100', + '/dev/sda', + '/dev/sdb', + '--journal-devices', + '/dev/sdc'] + result = ceph_volume.batch( + fake_module, fake_container_image) + assert result == expected_command_list