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 <aschoen@redhat.com>
pull/1797/head
Andrew Schoen 2017-08-23 08:59:57 -05:00
parent daca49cdb1
commit 594d5e017a
5 changed files with 43 additions and 19 deletions

View File

@ -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

View File

@ -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: []
##########

View File

@ -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:

View File

@ -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 }}"

View File

@ -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 }