From 4aa4496fc1de85a064f9d31629824e4f2e0d1201 Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Wed, 17 Jul 2019 15:55:12 +0200 Subject: [PATCH] validate: fail if gpt header found on unprepared devices 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 (cherry picked from commit 487d7016850524af64254aa3a9ec61222ec926a4) --- roles/ceph-validate/tasks/check_devices.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/roles/ceph-validate/tasks/check_devices.yml b/roles/ceph-validate/tasks/check_devices.yml index 69c2f8d36..b2568f779 100644 --- a/roles/ceph-validate/tasks/check_devices.yml +++ b/roles/ceph-validate/tasks/check_devices.yml @@ -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 }}"