diff --git a/library/ceph_volume.py b/library/ceph_volume.py index 9468a2012..6b3f7016a 100644 --- a/library/ceph_volume.py +++ b/library/ceph_volume.py @@ -114,6 +114,18 @@ options: - Only applicable if action is 'batch'. required: false default: -1 + block_db_devices: + description: + - A list of devices for bluestore block db to pass to the 'ceph-volume lvm batch' subcommand. + - Only applicable if action is 'batch'. + - Only applicable if objectstore is 'bluestore'. + required: false + wal_devices: + description: + - A list of devices for bluestore block wal to pass to the 'ceph-volume lvm batch' subcommand. + - Only applicable if action is 'batch'. + - Only applicable if objectstore is 'bluestore'. + required: false report: description: - If provided the --report flag will be passed to 'ceph-volume lvm batch'. @@ -320,10 +332,12 @@ def batch(module, container_image): cmd.extend(batch_devices) if block_db_devices and objectstore == 'bluestore': - cmd.extend(['--db-devices', ' '.join(block_db_devices)]) + cmd.append('--db-devices') + cmd.extend(block_db_devices) if wal_devices and objectstore == 'bluestore': - cmd.extend(['--wal-devices', ' '.join(wal_devices)]) + cmd.append('--wal-devices') + cmd.extend(wal_devices) return cmd diff --git a/tests/library/test_ceph_volume.py b/tests/library/test_ceph_volume.py index 1254c1c7a..917d94db7 100644 --- a/tests/library/test_ceph_volume.py +++ b/tests/library/test_ceph_volume.py @@ -344,3 +344,76 @@ class TestCephVolumeModule(object): result = ceph_volume.batch( fake_module, fake_container_image) assert result == expected_command_list + + def test_batch_bluestore_with_dedicated_db(self): + fake_module = MagicMock() + fake_module.params = {'objectstore': 'bluestore', + 'block_db_size': '-1', + 'cluster': 'ceph', + 'batch_devices': ["/dev/sda", "/dev/sdb"], + 'block_db_devices': ["/dev/sdc", "/dev/sdd"]} + + fake_container_image = None + expected_command_list = ['ceph-volume', + '--cluster', + 'ceph', + 'lvm', + 'batch', + '--bluestore', + '--yes', + '/dev/sda', + '/dev/sdb', + '--db-devices', + '/dev/sdc', + '/dev/sdd'] + result = ceph_volume.batch( + fake_module, fake_container_image) + assert result == expected_command_list + + def test_batch_bluestore_with_dedicated_wal(self): + fake_module = MagicMock() + fake_module.params = {'objectstore': 'bluestore', + 'cluster': 'ceph', + 'block_db_size': '-1', + 'batch_devices': ["/dev/sda", "/dev/sdb"], + 'wal_devices': ["/dev/sdc", "/dev/sdd"]} + + fake_container_image = None + expected_command_list = ['ceph-volume', + '--cluster', + 'ceph', + 'lvm', + 'batch', + '--bluestore', + '--yes', + '/dev/sda', + '/dev/sdb', + '--wal-devices', + '/dev/sdc', + '/dev/sdd'] + result = ceph_volume.batch( + fake_module, fake_container_image) + assert result == expected_command_list + + def test_batch_bluestore_with_custom_db_size(self): + fake_module = MagicMock() + fake_module.params = {'objectstore': 'bluestore', + 'cluster': 'ceph', + 'block_db_size': '4096', + 'batch_devices': ["/dev/sda", "/dev/sdb"]} + + fake_container_image = None + expected_command_list = ['ceph-volume', + '--cluster', + 'ceph', + 'lvm', + 'batch', + '--bluestore', + '--yes', + '--block-db-size', + '4096', + '/dev/sda', + '/dev/sdb'] + result = ceph_volume.batch( + fake_module, fake_container_image) + assert result == expected_command_list