]> git.apps.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
devices: allow using lvm_volumes with devices
authorSeena Fallah <seenafallah@gmail.com>
Sun, 26 Feb 2023 14:08:09 +0000 (15:08 +0100)
committerTeoman ONAY <tonay@redhat.com>
Fri, 17 Mar 2023 19:43:33 +0000 (20:43 +0100)
* 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 80b1ed9d4a3b133cb54fb13783071674baa856e5)

roles/ceph-config/tasks/main.yml
roles/ceph-facts/tasks/devices.yml

index 9ebac6c49a7b3f2850fde4ef36d2de6635e76a6d..d5fe72adc4dcced8e36e9b072bad6228a0b54587 100644 (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:
 
         - 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
index f981ced91ebd78dd0f1d6f31daedc388d4bd8af4..a66fafd9f004f42deb4ad871f4a2e27c82e780c0 100644 (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)