]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
ceph-osd: restructure lvm_volumes variable for more flexiblity
authorAndrew Schoen <aschoen@redhat.com>
Wed, 23 Aug 2017 13:59:57 +0000 (08:59 -0500)
committerAndrew Schoen <aschoen@redhat.com>
Wed, 23 Aug 2017 15:14:14 +0000 (10:14 -0500)
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>
docs/source/osds/scenarios.rst
roles/ceph-osd/defaults/main.yml
roles/ceph-osd/tasks/check_mandatory_vars.yml
roles/ceph-osd/tasks/scenarios/lvm.yml
tests/functional/centos/7/lvm-osds/group_vars/all

index 98d2c17247d46c9e713128db80d20330805afec0..7ee602bedd3ec767728b650748e5b6bab972b2ea 100644 (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
index e4d9f649fcd695b8f37a69370d0eeca3294a8627..d6d3511ffd146f02fc9e6008a17af130b555f115 100644 (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: []
 
 
 ##########
index 384738d8d1349d0936883129331577a2767e744f..a48b141da9b97c2e8125bf570c944792e9786c36 100644 (file)
     - 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:
index daa457c7caca2ca34031662f780efccb23bbb0cd..e149c1409870f3683423c732a44e8ff4cfd2a5c9 100644 (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 }}"
index 2aff22de4db40bf5fdc1b7f1d052f64724425c71..799b778da5b0d8a4fdd8cce4d97c283e2edae157 100644 (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 }