devices: allow using lvm_volumes with devices

* Exclude device from lvm_volumes while osd_auto_discovery is true
* Sum num_osds on both lvm_volumes and devices list

Signed-off-by: Seena Fallah <seenafallah@gmail.com>
(cherry picked from commit 80b1ed9d4a)
pull/7414/head
Seena Fallah 2023-02-26 15:08:09 +01:00 committed by Teoman ONAY
parent bd66017d46
commit 7206037c5d
2 changed files with 4 additions and 3 deletions

View File

@ -20,7 +20,7 @@
- name: count number of osds for lvm scenario
set_fact:
num_osds: "{{ lvm_volumes | length | int }}"
num_osds: "{{ num_osds | int + (lvm_volumes | length | int) }}"
when: lvm_volumes | default([]) | length > 0
- block:
@ -65,14 +65,14 @@
- name: set_fact num_osds from the output of 'ceph-volume lvm batch --report' (legacy report)
set_fact:
num_osds: "{{ ((lvm_batch_report.stdout | default('{}') | from_json).osds | default([]) | length | int) + (_rejected_devices | default([]) | length | int) }}"
num_osds: "{{ num_osds | int + ((lvm_batch_report.stdout | default('{}') | from_json).osds | default([]) | length | int) + (_rejected_devices | default([]) | length | int) }}"
when:
- (lvm_batch_report.stdout | default('{}') | from_json) is mapping
- (lvm_batch_report.stdout | default('{}') | from_json).changed | default(true) | bool
- name: set_fact num_osds from the output of 'ceph-volume lvm batch --report' (new report)
set_fact:
num_osds: "{{ ((lvm_batch_report.stdout | default('{}') | from_json) | default([]) | length | int) + (_rejected_devices | default([]) | length | int) }}"
num_osds: "{{ num_osds | int + ((lvm_batch_report.stdout | default('{}') | from_json) | default([]) | length | int) + (_rejected_devices | default([]) | length | int) }}"
when:
- (lvm_batch_report.stdout | default('{}') | from_json) is not mapping
- (lvm_batch_report.stdout | default('{}') | from_json).changed | default(true) | bool

View File

@ -64,3 +64,4 @@
- item.key is not match osd_auto_discovery_exclude
- device not in dedicated_devices | default([])
- device not in bluestore_wal_devices | default([])
- device not in (lvm_volumes | default([]) | map(attribute='data') | list)