From 594d5e017a09c7fc69cbb347833e35aa5f461b61 Mon Sep 17 00:00:00 2001 From: Andrew Schoen Date: Wed, 23 Aug 2017 08:59:57 -0500 Subject: [PATCH] ceph-osd: restructure lvm_volumes variable for more flexiblity The lvm_volumes variable is now a list of dictionaries that represent each OSD you'd like to deploy using ceph-volume. Each dictionary must have the following keys: data, journal and data_vg. Each dictionary also can optionaly provide a journal_vg key. The 'data' key represents the lv name used for the OSD and the 'data_vg' key is the vg name that the given lv resides on. The 'journal' key is either an lv, device or partition. The 'journal_vg' key is optional and must be the vg name for the journal lv if given. This key is mainly used for purging of the journal lv if purge-cluster.yml is run. For example: lvm_volumes: - data: data_lv1 journal: journal_lv1 data_vg: vg1 journal_vg: vg2 - data: data_lv2 journal: /dev/sdc data_vg: vg1 Signed-off-by: Andrew Schoen --- docs/source/osds/scenarios.rst | 24 ++++++++++++++----- roles/ceph-osd/defaults/main.yml | 24 +++++++++++++------ roles/ceph-osd/tasks/check_mandatory_vars.yml | 6 ++--- roles/ceph-osd/tasks/scenarios/lvm.yml | 4 ++-- .../centos/7/lvm-osds/group_vars/all | 4 +++- 5 files changed, 43 insertions(+), 19 deletions(-) diff --git a/docs/source/osds/scenarios.rst b/docs/source/osds/scenarios.rst index 98d2c1724..7ee602bed 100644 --- a/docs/source/osds/scenarios.rst +++ b/docs/source/osds/scenarios.rst @@ -173,17 +173,29 @@ is only available when the ceph release is Luminous or newer. Use ``osd_scenario: lvm`` to enable this scenario. Currently we only support dedicated journals when using lvm, not collocated journals. -To configure this scenario use the ``lvm_volumes`` config option. ``lvm_volumes`` is a dictionary whose -key/value pairs represent a data lv and a journal pair. Journals can be either a lv, device or partition. -You can not use the same journal for many data lvs. +To configure this scenario use the ``lvm_volumes`` config option. ``lvm_volumes`` is a list of dictionaries which can +contain a ``data``, ``journal``, ``data_vg`` and ``journal_vg`` key. The ``data`` key represents the logical volume name that is to be used for your OSD +data. The ``journal`` key represents the logical volume name, device or partition that will be used for your OSD journal. The ``data_vg`` +key represents the volume group name that your ``data`` logical volume resides on. This key is required for purging of OSDs created +by this scenario. The ``journal_vg`` key is optional and should be the volume group name that your journal lv resides on, if applicable. .. note:: Any logical volume or logical group used in ``lvm_volumes`` must be a name and not a path. +.. note:: + You can not use the same journal for many OSDs. + For example, a configuration to use the ``lvm`` osd scenario would look like:: osd_scenario: lvm lvm_volumes: - data-lv1: journal-lv1 - data-lv2: /dev/sda - data:lv3: /dev/sdb1 + - data: data-lv1 + data_vg: vg1 + journal: journal-lv1 + journal_vg: vg2 + - data: data-lv2 + journal: /dev/sda + data_vg: vg1 + - data: data-lv3 + journal: /dev/sdb1 + data_vg: vg2 diff --git a/roles/ceph-osd/defaults/main.yml b/roles/ceph-osd/defaults/main.yml index e4d9f649f..d6d3511ff 100644 --- a/roles/ceph-osd/defaults/main.yml +++ b/roles/ceph-osd/defaults/main.yml @@ -191,15 +191,25 @@ bluestore_wal_devices: "{{ dedicated_devices }}" # III. Use ceph-volume to create OSDs from logical volumes. # Use 'osd_scenario: lvm' to enable this scenario. Currently we only support dedicated journals # when using lvm, not collocated journals. -# lvm_volumes is a dictionary whose key/value pair represent a data lv and a journal pair. -# Any logical volume or logical group used must be a name and not a path. -# Journals can be either a lv, device or partition. You can not use the same journal for many data lvs. +# lvm_volumes is a list of dictionaries. Each dictionary must contain a data, journal and vg_name +# key. Any logical volume or logical group used must be a name and not a path. +# data must be a logical volume +# journal can be either a lv, device or partition. You can not use the same journal for many data lvs. +# data_vg must be the volume group name of the data lv +# journal_vg is optional and must be the volume group name of the journal lv, if applicable # For example: # lvm_volumes: -# data-lv1: journal-lv1 -# data-lv2: /dev/sda -# data:lv3: /dev/sdb1 -lvm_volumes: {} +# - data: data-lv1 +# data_vg: vg1 +# journal: journal-lv1 +# journal_vg: vg2 +# - data: data-lv2 +# journal: /dev/sda +# data_vg: vg1 +# - data: data-lv3 +# journal: /dev/sdb1 +# data_vg: vg2 +lvm_volumes: [] ########## diff --git a/roles/ceph-osd/tasks/check_mandatory_vars.yml b/roles/ceph-osd/tasks/check_mandatory_vars.yml index 384738d8d..a48b141da 100644 --- a/roles/ceph-osd/tasks/check_mandatory_vars.yml +++ b/roles/ceph-osd/tasks/check_mandatory_vars.yml @@ -77,15 +77,15 @@ - not osd_auto_discovery - lvm_volumes|length == 0 -- name: make sure the lvm_volumes variable is a dictionary +- name: make sure the lvm_volumes variable is a list fail: - msg: "lvm_volumes: must be a dictionary" + msg: "lvm_volumes: must be a list" when: - osd_group_name is defined - osd_group_name in group_names - not osd_auto_discovery - osd_scenario == "lvm" - - lvm_volumes is not mapping + - lvm_volumes is string - name: make sure the devices variable is a list fail: diff --git a/roles/ceph-osd/tasks/scenarios/lvm.yml b/roles/ceph-osd/tasks/scenarios/lvm.yml index daa457c7c..e149c1409 100644 --- a/roles/ceph-osd/tasks/scenarios/lvm.yml +++ b/roles/ceph-osd/tasks/scenarios/lvm.yml @@ -1,4 +1,4 @@ --- - name: use ceph-volume to create filestore osds with dedicated journals - command: "ceph-volume lvm create --filestore --data {{ item.key }} --journal {{ item.value }}" - with_dict: "{{ lvm_volumes }}" + command: "ceph-volume lvm create --filestore --data {{ item.data }} --journal {{ item.journal }}" + with_items: "{{ lvm_volumes }}" diff --git a/tests/functional/centos/7/lvm-osds/group_vars/all b/tests/functional/centos/7/lvm-osds/group_vars/all index 2aff22de4..799b778da 100644 --- a/tests/functional/centos/7/lvm-osds/group_vars/all +++ b/tests/functional/centos/7/lvm-osds/group_vars/all @@ -12,7 +12,9 @@ osd_scenario: lvm copy_admin_key: true # test-volume is created by tests/functional/lvm_setup.yml from /dev/sdb lvm_volumes: - test_volume: /dev/sdc + - data: test_volume + journal: /dev/sdc + data_vg: test_group os_tuning_params: - { name: kernel.pid_max, value: 4194303 } - { name: fs.file-max, value: 26234859 }