]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
ceph-validate: check block presence first
authorDimitri Savineau <dsavinea@redhat.com>
Tue, 15 Dec 2020 20:00:28 +0000 (15:00 -0500)
committerGuillaume Abrioux <gabrioux@redhat.com>
Fri, 2 Jul 2021 12:02:30 +0000 (14:02 +0200)
Instead of doing two parted calls we can check first if the device exist
and then test the partition table.

Signed-off-by: Dimitri Savineau <dsavinea@redhat.com>
roles/ceph-validate/tasks/check_devices.yml

index 930f45431b041c58cc7244b24bca2c70f2ff8594..4644b374f1b629df97b7d6789d89318ff75c36e5 100644 (file)
     msg: "{{ root_device }} found in either lvm_volumes or devices variable"
   when: root_device in lvm_volumes_data_devices | default([]) or root_device in _devices | default([])
 
-- name: check no gpt header is present when osd scenario is lvm/lvm-batch
-  block:
-    - name: read information about the devices
-      parted:
-        device: "{{ item.data if item.data_vg is undefined and lvm_volumes is defined else item if devices is defined else omit }}"
-        unit: MiB
-      register: parted_results
-      with_items: "{{ lvm_volumes | default(devices) }}"
-      when:
-        - inventory_hostname in groups.get(osd_group_name, [])
-        - (item.data is defined and item.data_vg is undefined) or devices is defined
-
-    - 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.skipped is undefined
-        - item.disk.table == 'gpt'
-        - item.partitions | length == 0
-
 - name: check devices are block devices
   block:
     - name: get devices information
         unit: MiB
       register: devices_parted
       failed_when: False
-      with_items: "{{ devices | default([]) }}"
+      with_items:
+        - "{{ devices | default([]) }}"
+        - "{{ lvm_volumes_data_devices | default([]) }}"
 
     - name: fail if one of the devices is not a device
       fail:
         msg: "{{ item.item }} is not a block special file!"
       when: item.rc is defined
       with_items: "{{ devices_parted.results }}"
+
+    - name: fail when gpt header found on osd devices
+      fail:
+        msg: "{{ item.disk.dev }} has gpt header, please remove it."
+      with_items: "{{ devices_parted.results }}"
+      when:
+        - item.skipped is undefined
+        - item.disk.table == 'gpt'
+        - item.partitions | length == 0