]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
ceph-config: calculate num_osds for the lvm batch scenario
authorAndrew Schoen <aschoen@redhat.com>
Tue, 18 Sep 2018 20:12:59 +0000 (15:12 -0500)
committermergify[bot] <mergify[bot]@users.noreply.github.com>
Thu, 20 Sep 2018 15:41:52 +0000 (15:41 +0000)
For now our best guess is to count the number of devices and multiply
by osds_per_device. Ideally we'd like to run ceph-volume lvm batch
--report and get the number of OSDs that way, but currently we need
a ceph.conf in place already before we can do that. There is a tracker
ticket that would allow os to get around the need for a ceph.conf:
http://tracker.ceph.com/issues/36088

Fixes: https://github.com/ceph/ceph-ansible/issues/3135
Signed-off-by: Andrew Schoen <aschoen@redhat.com>
roles/ceph-config/tasks/main.yml

index da48db96ad0a8e79b444b7d33fc557e53eb80981..0e1e4389ca6227b85efa1ed78dc6cc24deea292c 100644 (file)
       mode: "0755"
 
   - block:
-    - name: count number of osds for non-lvm scenario
+    - name: count number of osds for ceph-disk scenarios
       set_fact:
         num_osds: "{{ devices | length | int }}"
       when:
         - devices | default([]) | length > 0
-        - (osd_scenario == 'collocated' or osd_scenario == 'non-collocated')
+        - osd_scenario in ['collocated', 'non-collocated']
 
     - name: count number of osds for lvm scenario
       set_fact:
         - lvm_volumes | default([]) | length > 0
         - osd_scenario == 'lvm'
 
-    - name: get number of osds for lvm-batch scenario
-      command: "ceph-volume lvm batch --report --format=json --osds-per-device osds_per_device {{ devices | join(' ') }}"
-      register: lvm_batch_devices
-      when:
-        - devices | default([]) | length > 0
-        - osd_scenario == 'lvm'
-
-    - name: set_fact num_osds
+    # This is a best guess. Ideally we'd like to use `ceph-volume lvm batch --report` to get
+    # a more accurate number but the ceph.conf needs to be in place before that is possible.
+    # There is a tracker to add functionality to ceph-volume which would allow doing this
+    # without the need for a ceph.conf: http://tracker.ceph.com/issues/36088
+    - name: count number of osds for lvm batch scenario
       set_fact:
-        num_osds: "{{ (lvm_batch_devices.stdout | from_json).osds | length | int }}"
+        num_osds: "{{ devices | length | int * osds_per_device | default(1) }}"
       when:
         - devices | default([]) | length > 0
         - osd_scenario == 'lvm'