From 16ccac83fe27c63be1811a44d43c8b1df417e57e Mon Sep 17 00:00:00 2001 From: Andrew Schoen Date: Tue, 18 Sep 2018 15:12:59 -0500 Subject: [PATCH] ceph-config: calculate num_osds for the lvm batch scenario 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 --- roles/ceph-config/tasks/main.yml | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/roles/ceph-config/tasks/main.yml b/roles/ceph-config/tasks/main.yml index da48db96a..0e1e4389c 100644 --- a/roles/ceph-config/tasks/main.yml +++ b/roles/ceph-config/tasks/main.yml @@ -10,12 +10,12 @@ 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: @@ -24,16 +24,13 @@ - 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' -- 2.39.5