Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ceph-config: fix calculation of num_osds #7502

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion roles/ceph-config/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,21 @@
changed_when: false

- name: Set_fact num_osds (add existing osds)
vars:
lvm_volumes_devices: "{{ lvm_volumes | default([]) | rejectattr('data_vg', 'defined') | map(attribute='data') | list }}"

Check warning on line 95 in roles/ceph-config/tasks/main.yml

View workflow job for this annotation

GitHub Actions / build

jinja[spacing]

Jinja2 spacing could be improved: {{ ['/dev'] | product( lvm_volumes | default([]) | selectattr('data_vg', 'defined') | map(attribute='data_vg') | zip( lvm_volumes | default([]) | selectattr('data_vg', 'defined') | map(attribute='data') ) | map('join', '/') ) | map('join', '/') }} -> {{ ['/dev'] | product(lvm_volumes | default([]) | selectattr('data_vg', 'defined') | map(attribute='data_vg') | zip(lvm_volumes | default([]) | selectattr('data_vg', 'defined') | map(attribute='data')) | map('join', '/')) | map('join', '/') }}
lvm_volumes_lv_paths: "{{
['/dev']
| product(
lvm_volumes | default([]) | selectattr('data_vg', 'defined') | map(attribute='data_vg')
| zip(
lvm_volumes | default([]) | selectattr('data_vg', 'defined') | map(attribute='data')
)
| map('join', '/')
)
| map('join', '/')
}}"
ansible.builtin.set_fact:
num_osds: "{{ num_osds | int + (lvm_list.stdout | default('{}') | from_json | dict2items | map(attribute='value') | flatten | map(attribute='devices') | sum(start=[]) | difference(lvm_volumes | default([]) | map(attribute='data')) | length | int) }}"
num_osds: "{{ num_osds | int + (lvm_list.stdout | default('{}') | from_json | dict2items | map(attribute='value') | flatten | selectattr('type', 'equalto', 'block') | rejectattr('lv_path', 'in', lvm_volumes_lv_paths) | map(attribute='devices') | flatten | reject('in', lvm_volumes_devices) | length | int) }}"

- name: Set osd related config facts
when: inventory_hostname in groups.get(osd_group_name, [])
Expand Down
Loading