From: Sébastien Han Date: Mon, 24 Jul 2017 09:35:08 +0000 (+0200) Subject: osd: refactor osd scenarios X-Git-Tag: v2.3.0rc5~4^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=33c1f0cb03fd783768ed275eea9080aa970b3650;p=ceph-ansible.git osd: refactor osd scenarios We have multiple issues with ceph-disk's cli with bluestore and Ceph releases. This is mainly due to cli changes with Luminous. Luminous introduced a --bluestore and --filestore options which respectively does not exist on releases older than Luminous. The default store being bluestore on Luminous, simply checking for the store is not enough so we have to build a specific command line for ceph-disk depending on the Ceph version we are running and the desired osd_store. Signed-off-by: Sébastien Han --- diff --git a/roles/ceph-osd/tasks/main.yml b/roles/ceph-osd/tasks/main.yml index 3fbd2266f..11a7f0d7b 100644 --- a/roles/ceph-osd/tasks/main.yml +++ b/roles/ceph-osd/tasks/main.yml @@ -8,7 +8,7 @@ - include: ./scenarios/journal_collocation.yml when: - - journal_collocation + - (journal_collocation or dmcrypt_journal_collocation) - not containerized_deployment # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) static: False @@ -20,13 +20,6 @@ # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) static: False -- include: ./scenarios/dmcrypt-journal-collocation.yml - when: - - dmcrypt_journal_collocation - - not containerized_deployment - # Hard code this so we will skip the entire file instead of individual tasks (Default isn't Consistent) - static: False - - include: ./scenarios/dmcrypt-dedicated-journal.yml when: - dmcrypt_dedicated_journal diff --git a/roles/ceph-osd/tasks/scenarios/dmcrypt-dedicated-journal.yml b/roles/ceph-osd/tasks/scenarios/dmcrypt-dedicated-journal.yml index ae7fb11df..cb58e0a1b 100644 --- a/roles/ceph-osd/tasks/scenarios/dmcrypt-dedicated-journal.yml +++ b/roles/ceph-osd/tasks/scenarios/dmcrypt-dedicated-journal.yml @@ -3,31 +3,32 @@ - include: ../check_devices.yml +- set_fact: + ceph_disk_cli_options: "--cluster {{ cluster }} --bluestore --dmcrypt" + when: + - osd_objectstore == 'bluestore' + - ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous + +- set_fact: + ceph_disk_cli_options: "--cluster {{ cluster }} --filestore --dmcrypt" + when: + - osd_objectstore == 'filestore' + - ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous + +- set_fact: + ceph_disk_cli_options: "--cluster {{ cluster }} --dmcrypt" + when: + - osd_objectstore == 'filestore' + - ceph_release_num.{{ ceph_release }} < ceph_release_num.luminous + # NOTE (leseb): the prepare process must be parallelized somehow... # if you have 64 disks with 4TB each, this will take a while # since Ansible will sequential process the loop # NOTE (alahouze): if the device is a partition, the parted command below has # failed, this is why we check if the device is a partition too. -- name: prepare dmcrypt osd disk(s) with a dedicated journal device (filestore) - command: "ceph-disk prepare --dmcrypt --cluster {{ cluster }} {{ item.2 }} {{ item.3 }}" - with_together: - - "{{ parted_results.results }}" - - "{{ ispartition_results.results }}" - - "{{ devices }}" - - "{{ raw_journal_devices }}" - changed_when: false - when: - - not item.0.get("skipped") - - not item.1.get("skipped") - - item.0.get("rc", 0) != 0 - - item.1.get("rc", 0) != 0 - - not osd_auto_discovery - - osd_objectstore == 'filestore' - - dmcrypt_dedicated_journal - -- name: prepare dmcrypt osd disk(s) with a dedicated journal device (bluestore) - command: "ceph-disk prepare --bluestore --dmcrypt --cluster {{ cluster }} {{ item.2 }} {{ item.3 }}" +- name: prepare dmcrypt osd disk(s) with a dedicated journal device on "{{ osd_objectstore }}" + command: "ceph-disk prepare {{ ceph_disk_cli_options }} {{ item.2 }} {{ item.3 }}" with_together: - "{{ parted_results.results }}" - "{{ ispartition_results.results }}" @@ -40,7 +41,5 @@ - item.0.get("rc", 0) != 0 - item.1.get("rc", 0) != 0 - not osd_auto_discovery - - osd_objectstore == 'bluestore' - - dmcrypt_dedicated_journal - include: ../activate_osds.yml diff --git a/roles/ceph-osd/tasks/scenarios/dmcrypt-journal-collocation.yml b/roles/ceph-osd/tasks/scenarios/dmcrypt-journal-collocation.yml deleted file mode 100644 index 0b0970187..000000000 --- a/roles/ceph-osd/tasks/scenarios/dmcrypt-journal-collocation.yml +++ /dev/null @@ -1,66 +0,0 @@ ---- -## SCENARIO 5: DMCRYPT - -- include: ../check_devices.yml - -# NOTE (leseb): the prepare process must be parallelized somehow... -# if you have 64 disks with 4TB each, this will take a while -# since Ansible will sequential process the loop - -# NOTE (alahouze): if the device is a partition, the parted command below has -# failed, this is why we check if the device is a partition too. -- name: automatic prepare dmcrypt osd disk(s) without partitions with collocated osd data and journal (filestore) - command: ceph-disk prepare --dmcrypt --cluster "{{ cluster }}" "/dev/{{ item.key }}" - with_dict: "{{ ansible_devices }}" - when: - - ansible_devices is defined - - item.value.removable == "0" - - item.value.partitions|count == 0 - - item.value.holders|count == 0 - - dmcrypt_journal_collocation - - osd_objectstore == 'filestore' - - osd_auto_discovery - -- name: automatic prepare dmcrypt osd disk(s) without partitions with collocated osd data and journal (bluestore) - command: ceph-disk prepare --bluestore --dmcrypt --cluster "{{ cluster }}" "/dev/{{ item.key }}" - with_dict: "{{ ansible_devices }}" - when: - - ansible_devices is defined - - item.value.removable == "0" - - item.value.partitions|count == 0 - - item.value.holders|count == 0 - - dmcrypt_journal_collocation - - osd_objectstore == 'bluestore' - - osd_auto_discovery - -- name: manually prepare dmcrypt osd disk(s) with collocated osd data and journal (filestore) - command: ceph-disk prepare --dmcrypt --cluster "{{ cluster }}" "{{ item.2 }}" - with_together: - - "{{ parted_results.results }}" - - "{{ ispartition_results.results }}" - - "{{ devices }}" - when: - - not item.0.get("skipped") - - not item.1.get("skipped") - - item.0.get("rc", 0) != 0 - - item.1.get("rc", 0) != 0 - - dmcrypt_journal_collocation - - osd_objectstore == 'filestore' - - not osd_auto_discovery - -- name: manually prepare dmcrypt osd disk(s) with collocated osd data and journal (bluestore) - command: ceph-disk prepare --bluestore --dmcrypt --cluster "{{ cluster }}" "{{ item.2 }}" - with_together: - - "{{ parted_results.results }}" - - "{{ ispartition_results.results }}" - - "{{ devices }}" - when: - - not item.0.get("skipped") - - not item.1.get("skipped") - - item.0.get("rc", 0) != 0 - - item.1.get("rc", 0) != 0 - - dmcrypt_journal_collocation - - osd_objectstore == 'bluestore' - - not osd_auto_discovery - -- include: ../activate_osds.yml diff --git a/roles/ceph-osd/tasks/scenarios/journal_collocation.yml b/roles/ceph-osd/tasks/scenarios/journal_collocation.yml index da7d7be33..05c37e6b6 100644 --- a/roles/ceph-osd/tasks/scenarios/journal_collocation.yml +++ b/roles/ceph-osd/tasks/scenarios/journal_collocation.yml @@ -7,38 +7,52 @@ # if you have 64 disks with 4TB each, this will take a while # since Ansible will sequential process the loop -# NOTE (alahouze): if the device is a partition, the parted command below has -# failed, this is why we check if the device is a partition too. -- name: automatic prepare filestore osd disk(s) without partitions with collocated osd data and journal - command: ceph-disk prepare --cluster "{{ cluster }}" "/dev/{{ item.key }}" - register: prepared_osds - with_dict: "{{ ansible_devices }}" +- set_fact: + ceph_disk_cli_options: "--cluster {{ cluster }} --bluestore" when: - - ansible_devices is defined - - item.value.removable == "0" - - item.value.partitions|count == 0 - - item.value.holders|count == 0 + - osd_objectstore == 'bluestore' - journal_collocation + - ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous + +- set_fact: + ceph_disk_cli_options: "--cluster {{ cluster }} --filestore" + when: - osd_objectstore == 'filestore' - - osd_auto_discovery + - journal_collocation + - ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous -- name: manually prepare filestore osd disk(s) with collocated osd data and journal - command: "ceph-disk prepare --cluster {{ cluster }} {{ item.2 }}" - with_together: - - "{{ parted_results.results }}" - - "{{ ispartition_results.results }}" - - "{{ devices }}" +- set_fact: + ceph_disk_cli_options: "--cluster {{ cluster }}" when: - - not item.0.get("skipped") - - not item.1.get("skipped") - - item.0.get("rc", 0) != 0 - - item.1.get("rc", 0) != 0 + - osd_objectstore == 'filestore' - journal_collocation + - ceph_release_num.{{ ceph_release }} < ceph_release_num.luminous + +- set_fact: + ceph_disk_cli_options: "--cluster {{ cluster }} --bluestore --dmcrypt" + when: + - osd_objectstore == 'bluestore' + - dmcrypt_journal_collocation + - ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous + +- set_fact: + ceph_disk_cli_options: "--cluster {{ cluster }} --filestore --dmcrypt" + when: - osd_objectstore == 'filestore' - - not osd_auto_discovery + - dmcrypt_journal_collocation + - ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous -- name: automatic prepare bluestore osd disk(s) without partitions - command: ceph-disk prepare --bluestore --cluster "{{ cluster }}" "/dev/{{ item.key }}" +- set_fact: + ceph_disk_cli_options: "--cluster {{ cluster }} --dmcrypt" + when: + - osd_objectstore == 'filestore' + - dmcrypt_journal_collocation + - ceph_release_num.{{ ceph_release }} < ceph_release_num.luminous + +# NOTE (alahouze): if the device is a partition, the parted command below has +# failed, this is why we check if the device is a partition too. +- name: automatic prepare "{{ osd_objectstore }}" osd disk(s) without partitions with collocated osd data and journal + command: "ceph-disk prepare {{ ceph_disk_cli_options }} /dev/{{ item.key }}" register: prepared_osds with_dict: "{{ ansible_devices }}" when: @@ -46,12 +60,10 @@ - item.value.removable == "0" - item.value.partitions|count == 0 - item.value.holders|count == 0 - - journal_collocation - - osd_objectstore == 'bluestore' - osd_auto_discovery -- name: manually prepare bluestore osd disk(s) - command: ceph-disk prepare --bluestore --cluster "{{ cluster }}" "{{ item.2 }}" +- name: manually prepare "{{ osd_objectstore }}" osd disk(s) with collocated osd data and journal + command: "ceph-disk prepare {{ ceph_disk_cli_options }} {{ item.2 }}" with_together: - "{{ parted_results.results }}" - "{{ ispartition_results.results }}" @@ -61,8 +73,6 @@ - not item.1.get("skipped") - item.0.get("rc", 0) != 0 - item.1.get("rc", 0) != 0 - - journal_collocation - - osd_objectstore == 'bluestore' - not osd_auto_discovery - include: ../activate_osds.yml diff --git a/roles/ceph-osd/tasks/scenarios/raw_multi_journal.yml b/roles/ceph-osd/tasks/scenarios/raw_multi_journal.yml index 0e700aa6f..862af10af 100644 --- a/roles/ceph-osd/tasks/scenarios/raw_multi_journal.yml +++ b/roles/ceph-osd/tasks/scenarios/raw_multi_journal.yml @@ -8,13 +8,25 @@ # since Ansible will sequential process the loop - set_fact: - osd_type: "--filestore" - when: + ceph_disk_cli_options: "--cluster {{ cluster }} --bluestore" + when: + - osd_objectstore == 'bluestore' + - ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous + +- set_fact: + ceph_disk_cli_options: "--cluster {{ cluster }} --filestore" + when: + - osd_objectstore == 'filestore' - ceph_release_num.{{ ceph_release }} >= ceph_release_num.luminous + +- set_fact: + ceph_disk_cli_options: "--cluster {{ cluster }}" + when: - osd_objectstore == 'filestore' + - ceph_release_num.{{ ceph_release }} < ceph_release_num.luminous - name: prepare filestore osd disk(s) with a dedicated journal device - command: "ceph-disk prepare {{ osd_type | default('') }} --cluster {{ cluster }} {{ item.1 }} {{ item.2 }}" + command: "ceph-disk prepare {{ ceph_disk_cli_options }} {{ item.1 }} {{ item.2 }}" with_together: - "{{ parted_results.results }}" - "{{ devices }}" @@ -22,12 +34,11 @@ changed_when: false when: - item.0.get("skipped") or item.0.get("rc", 0) != 0 - - raw_multi_journal - osd_objectstore == 'filestore' - not osd_auto_discovery - name: manually prepare bluestore osd disk(s) with a dedicated device for db and wal - command: "ceph-disk prepare --bluestore --cluster {{ cluster }} --block.db {{ item.1 }} --block.wal {{ item.2 }} {{ item.3 }}" + command: "ceph-disk prepare {{ ceph_disk_cli_options }} --block.db {{ item.1 }} --block.wal {{ item.2 }} {{ item.3 }}" with_together: - "{{ parted_results.results }}" - "{{ raw_journal_devices }}" @@ -36,7 +47,6 @@ when: - not item.0.get("skipped") - item.0.get("rc", 0) != 0 - - raw_multi_journal - osd_objectstore == 'bluestore' - not osd_auto_discovery