]> 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, 22 Aug 2019 14:59:34 +0000 (16:59 +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>
(cherry picked from commit 487d7016850524af64254aa3a9ec61222ec926a4)

roles/ceph-validate/tasks/check_devices.yml

index d8310490a0a33d86a5e34e1575b31ee36c5639f1..b6dc970c1066446dc63bbb659cd84478e5c65127 100644 (file)
@@ -1,6 +1,21 @@
 ---
 - name: devices validation
   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 }}"