devices: test devices before collecting on auto discovery

In some scenarios with NVMe, a device might be identified by
Ansible but could actually be a multipath device rather than an
actual device. We need to exclude these as Ceph cannot create
OSDs on them.

Signed-off-by: Seena Fallah <seenafallah@gmail.com>
pull/7601/head
Seena Fallah 2024-07-30 22:11:55 +02:00 committed by Guillaume Abrioux
parent 2c88ecc784
commit be9b458524
1 changed files with 17 additions and 4 deletions

View File

@ -47,12 +47,13 @@
ansible.builtin.set_fact: ansible.builtin.set_fact:
bluestore_wal_devices: "{{ bluestore_wal_devices_prepare_canonicalize.results | map(attribute='stdout') | reject('search', '/dev/disk') | list | unique }}" bluestore_wal_devices: "{{ bluestore_wal_devices_prepare_canonicalize.results | map(attribute='stdout') | reject('search', '/dev/disk') | list | unique }}"
- name: Set_fact devices generate device list when osd_auto_discovery - name: Collect existed devices
vars: vars:
device: "{{ item.key | regex_replace('^', '/dev/') }}" device: "{{ item.key | regex_replace('^', '/dev/') }}"
ansible.builtin.set_fact: ansible.builtin.command: test -b {{ device }}
devices: "{{ devices | default([]) | union([device]) }}" changed_when: false
with_dict: "{{ ansible_facts['devices'] }}" ignore_errors: true
loop: "{{ ansible_facts['devices'] | dict2items }}"
when: when:
- osd_auto_discovery | default(False) | bool - osd_auto_discovery | default(False) | bool
- ansible_facts['devices'] is defined - ansible_facts['devices'] is defined
@ -65,3 +66,15 @@
- device not in dedicated_devices | default([]) - device not in dedicated_devices | default([])
- device not in bluestore_wal_devices | default([]) - device not in bluestore_wal_devices | default([])
- device not in (lvm_volumes | default([]) | map(attribute='data') | list) - device not in (lvm_volumes | default([]) | map(attribute='data') | list)
register: devices_check
- name: Set_fact devices generate device list when osd_auto_discovery
vars:
device: "{{ item.item.key | regex_replace('^', '/dev/') }}"
ansible.builtin.set_fact:
devices: "{{ devices | default([]) | union([device]) }}"
loop: "{{ devices_check.results }}"
when:
- devices_check is defined
- not item.skipped | default(false)
- not item.failed | default(false)