]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
osd: refactor osd scenarios 1704/head
authorSébastien Han <seb@redhat.com>
Mon, 24 Jul 2017 09:35:08 +0000 (11:35 +0200)
committerSébastien Han <seb@redhat.com>
Mon, 24 Jul 2017 11:48:08 +0000 (13:48 +0200)
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 <seb@redhat.com>
roles/ceph-osd/tasks/main.yml
roles/ceph-osd/tasks/scenarios/dmcrypt-dedicated-journal.yml
roles/ceph-osd/tasks/scenarios/dmcrypt-journal-collocation.yml [deleted file]
roles/ceph-osd/tasks/scenarios/journal_collocation.yml
roles/ceph-osd/tasks/scenarios/raw_multi_journal.yml

index 3fbd2266fe8c52d3e388eee96c41e29602d87752..11a7f0d7be09ed0994c0a99b90f0d7aa859e9d61 100644 (file)
@@ -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
   # 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
index ae7fb11df945312c25a367a28ad923a2115ef32d..cb58e0a1b8d31e5bf1c7931fa518ab0c8808bce0 100644 (file)
@@ -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 (file)
index 0b09701..0000000
+++ /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
index da7d7be333c113b23a079fe122db40af004f7f27..05c37e6b6a593a64a0f75b9240dee0965863a3e5 100644 (file)
@@ -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:
     - 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
index 0e700aa6ffca0897e47fee13cee016dffd1eefaf..862af10af6825b28727dd0296180598750c33818 100644 (file)
@@ -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 }}"
   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