]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
validate: fail if gpt header found on unprepared devices
authorGuillaume Abrioux <gabrioux@redhat.com>
Wed, 17 Jul 2019 13:55:12 +0000 (15:55 +0200)
committerGuillaume Abrioux <gabrioux@redhat.com>
Thu, 18 Jul 2019 05:43:55 +0000 (07:43 +0200)
ceph-volume will complain if gpt headers are found on devices.
This commit checks whether a gpt header is present on devices passed in
`devices` variable and fail early.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1730541
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
roles/ceph-validate/tasks/check_devices.yml

index 69c2f8d369df23ce916106a41d1d87ac128ca958..b2568f779789a7f80647742202c8f358cd1168e1 100644 (file)
@@ -2,6 +2,21 @@
 - name: devices validation
   when: devices is defined
   block:
+    - name: read information about the devices
+      parted:
+        device: "{{ item }}"
+        unit: MiB
+      register: parted_results
+      with_items: "{{ devices }}"
+
+    - name: fail when gpt header found on osd devices
+      fail:
+        msg: "{{ item.disk.dev }} has gpt header, please remove it."
+      with_items: "{{ parted_results.results }}"
+      when:
+        - item.disk.table == 'gpt'
+        - item.partitions | length == 0
+
     - name: get devices information
       parted:
         device: "{{ item }}"