From 7b836eaa47fc0a84d5c5d79dfadd9dab96eb6472 Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Tue, 20 Aug 2019 15:57:45 +0200 Subject: [PATCH] osd: add block_db_devices option support to ceph_volume module This commit adds the `block_db_devices` option support to the ceph_volume module. passing a devices list in `dedicated_devices` will make ceph-volume creating 1 vg using these devices to create block.db partitions for data devices. Signed-off-by: Guillaume Abrioux --- group_vars/osds.yml.sample | 7 +++++++ library/ceph_volume.py | 5 +++++ roles/ceph-osd/defaults/main.yml | 7 +++++++ roles/ceph-osd/tasks/scenarios/lvm-batch.yml | 1 + 4 files changed, 20 insertions(+) diff --git a/group_vars/osds.yml.sample b/group_vars/osds.yml.sample index 255a61f4a..231fab646 100644 --- a/group_vars/osds.yml.sample +++ b/group_vars/osds.yml.sample @@ -41,6 +41,13 @@ dummy: #devices: [] +# Declare devices to be used as block.db devices + +#dedicated_devices: +# - /dev/sda +# - /dev/sdb + +#dedicated_devices: [] #'osd_auto_discovery' mode prevents you from filling out the 'devices' variable above. # Device discovery is based on the Ansible fact 'ansible_devices' diff --git a/library/ceph_volume.py b/library/ceph_volume.py index 48f3fef54..a963a027b 100644 --- a/library/ceph_volume.py +++ b/library/ceph_volume.py @@ -279,6 +279,7 @@ def batch(module, container_image): crush_device_class = module.params.get('crush_device_class', 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) dmcrypt = module.params.get('dmcrypt', None) osds_per_device = module.params.get('osds_per_device', 1) @@ -317,6 +318,9 @@ def batch(module, container_image): cmd.extend(batch_devices) + if block_db_devices: + cmd.extend(['--db-devices', ' '.join(block_db_devices)]) + return cmd @@ -503,6 +507,7 @@ def run_module(): osds_per_device=dict(type='int', required=False, default=1), journal_size=dict(type='str', required=False, default='5120'), block_db_size=dict(type='str', required=False, default='-1'), + block_db_devices=dict(type='list', required=False, default=[]), report=dict(type='bool', required=False, default=False), containerized=dict(type='str', required=False, default=False), osd_fsid=dict(type='str', required=False), diff --git a/roles/ceph-osd/defaults/main.yml b/roles/ceph-osd/defaults/main.yml index 178c807c5..f3dbb93b0 100644 --- a/roles/ceph-osd/defaults/main.yml +++ b/roles/ceph-osd/defaults/main.yml @@ -33,6 +33,13 @@ copy_admin_key: false devices: [] +# Declare devices to be used as block.db devices + +#dedicated_devices: +# - /dev/sda +# - /dev/sdb + +dedicated_devices: [] #'osd_auto_discovery' mode prevents you from filling out the 'devices' variable above. # Device discovery is based on the Ansible fact 'ansible_devices' diff --git a/roles/ceph-osd/tasks/scenarios/lvm-batch.yml b/roles/ceph-osd/tasks/scenarios/lvm-batch.yml index e1f1b304d..0b11f3a14 100644 --- a/roles/ceph-osd/tasks/scenarios/lvm-batch.yml +++ b/roles/ceph-osd/tasks/scenarios/lvm-batch.yml @@ -10,6 +10,7 @@ osds_per_device: "{{ osds_per_device }}" journal_size: "{{ journal_size }}" block_db_size: "{{ block_db_size }}" + block_db_devices: "{{ dedicated_devices | unique if dedicated_devices | length > 0 else omit }}" action: "batch" environment: CEPH_VOLUME_DEBUG: 1