]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
osd: do not do anything if the dev has a partition
authorSébastien Han <seb@redhat.com>
Fri, 13 Apr 2018 14:36:43 +0000 (16:36 +0200)
committerGuillaume Abrioux <gabrioux@redhat.com>
Fri, 13 Apr 2018 17:11:15 +0000 (19:11 +0200)
Regardless if the partition is 'ceph' or something else, we don't want
to be as strick as checking for a particular partition.
If the drive has a partition, we just don't do anything.

This solves the case where the server reboots, disks get a different
/dev/sda (node) allocation. In this case, prior to restarting the server
/dev/sda was an OSD, but now it's /dev/sdb and the other way around.
In such scenario, we will try to prepare the OSD and create a new
partition, so let's not mess around with devices that have partitions.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1498303
Signed-off-by: Sébastien Han <seb@redhat.com>
roles/ceph-osd/tasks/main.yml
roles/ceph-osd/tasks/scenarios/collocated.yml
roles/ceph-osd/tasks/scenarios/non-collocated.yml

index 1bef0ceae760817c1678883fc39cb0d8da1dd6bd..4d528ec29e10d7965c1f36acc8655f3d15b7a78c 100644 (file)
 - name: include build_devices.yml
   include: build_devices.yml
 
-- name: check if a partition named 'ceph' exists
-  shell: "parted --script {{ item }} print | egrep -sq '^ 1.*ceph'"
-  with_items:
-    - "{{ devices }}"
-  changed_when: false
-  failed_when: false
-  check_mode: no
+- name: read information about the devices
+  parted:
+    device: "{{ item }}"
+    unit: MiB
   register: parted_results
+  with_items: "{{ devices }}"
 
 - name: include copy_configs.yml
   include: copy_configs.yml
index 9ec407eb8e688c69a97b827b9237336e4afe9f23..82cde9da5ee27331343ab9c3983afd667a5a18c7 100644 (file)
@@ -25,8 +25,7 @@
   when:
     - not osd_auto_discovery
     - containerized_deployment
-    - not item.0.get("skipped")
-    - item.0.get("rc", 0) != 0
+    - item.0.partitions|length == 0
 
 - name: automatic prepare ceph containerized osd disk collocated
   shell: |
@@ -58,5 +57,4 @@
     - "{{ devices }}"
   when:
     - not containerized_deployment
-    - not item.0.get("skipped")
-    - item.0.get("rc", 0) != 0
+    - item.0.partitions|length == 0
\ No newline at end of file
index 9b8c73f57aef1393049c8f99efbe3ecbc9edd097..ac4f914549c4dab7057cfd91068946696334f075 100644 (file)
@@ -27,8 +27,7 @@
   when:
     - containerized_deployment
     - osd_objectstore == 'filestore'
-    - not item.0.get("skipped")
-    - item.0.get("rc", 0) != 0
+    - item.0.partitions|length == 0
 
 - name: prepare ceph "{{ osd_objectstore }}" containerized osd disk(s) non-collocated with a dedicated device for db and wal
   shell: |
@@ -57,8 +56,7 @@
   when:
     - containerized_deployment
     - osd_objectstore == 'bluestore'
-    - not item.0.get("skipped")
-    - item.0.get("rc", 0) != 0
+    - item.0.partitions|length == 0
 
 - name: prepare ceph "{{ osd_objectstore }}" non-containerized osd disk(s) non-collocated
   command: "ceph-disk prepare {{ ceph_disk_cli_options }} {{ item.1 }} {{ item.2 }}"
@@ -70,8 +68,7 @@
   when:
     - osd_objectstore == 'filestore'
     - not containerized_deployment
-    - not item.0.get("skipped")
-    - item.0.get("rc", 0) != 0
+    - item.0.partitions|length == 0
 
 - name: manually prepare ceph "{{ osd_objectstore }}" non-containerized osd disk(s) with a dedicated device for db and wal
   command: "ceph-disk prepare {{ ceph_disk_cli_options }} --block.db {{ item.1 }} --block.wal {{ item.2 }} {{ item.3 }}"
@@ -83,5 +80,4 @@
   when:
     - osd_objectstore == 'bluestore'
     - not containerized_deployment
-    - not item.0.get("skipped")
-    - item.0.get("rc", 0) != 0
+    - item.0.partitions|length == 0
\ No newline at end of file