From 9efa4f2774877039ff7fb19c336ed06db7545944 Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Mon, 11 Jul 2022 10:23:56 +0200 Subject: [PATCH] config/osd: various fixes - sets `osd_memory_target` per osd host. - ceph.conf refactor (osd) Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2056675 Signed-off-by: Guillaume Abrioux (cherry picked from commit 8a5628b51616b0b9740680bd14c669d4316941f3) --- group_vars/all.yml.sample | 1 + group_vars/rhcs.yml.sample | 1 + roles/ceph-config/tasks/main.yml | 12 ++++++++++++ roles/ceph-config/templates/ceph.conf.j2 | 11 ----------- roles/ceph-defaults/defaults/main.yml | 1 + 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/group_vars/all.yml.sample b/group_vars/all.yml.sample index 4958d5c66..39d707668 100644 --- a/group_vars/all.yml.sample +++ b/group_vars/all.yml.sample @@ -358,6 +358,7 @@ dummy: #is_hci: false #hci_safety_factor: 0.2 #non_hci_safety_factor: 0.7 +#safety_factor: "{{ hci_safety_factor if is_hci | bool else non_hci_safety_factor }}" #osd_memory_target: 4294967296 #journal_size: 5120 # OSD journal size in MB #block_db_size: -1 # block db size in bytes for the ceph-volume lvm batch. -1 means use the default of 'as big as possible'. diff --git a/group_vars/rhcs.yml.sample b/group_vars/rhcs.yml.sample index 2b5fef90f..0ba838c2a 100644 --- a/group_vars/rhcs.yml.sample +++ b/group_vars/rhcs.yml.sample @@ -358,6 +358,7 @@ ceph_iscsi_config_dev: false #is_hci: false #hci_safety_factor: 0.2 #non_hci_safety_factor: 0.7 +#safety_factor: "{{ hci_safety_factor if is_hci | bool else non_hci_safety_factor }}" #osd_memory_target: 4294967296 #journal_size: 5120 # OSD journal size in MB #block_db_size: -1 # block db size in bytes for the ceph-volume lvm batch. -1 means use the default of 'as big as possible'. diff --git a/roles/ceph-config/tasks/main.yml b/roles/ceph-config/tasks/main.yml index a286d9d8a..2655acad3 100644 --- a/roles/ceph-config/tasks/main.yml +++ b/roles/ceph-config/tasks/main.yml @@ -98,6 +98,18 @@ when: - devices | default([]) | length > 0 + - name: set_fact _osd_memory_target + set_fact: + _osd_memory_target: "{{ ((ansible_facts['memtotal_mb'] * 1048576 * safety_factor | float) / num_osds | float) | int }}" + when: + - num_osds | default(0) | int > 0 + - ((ansible_facts['memtotal_mb'] * 1048576 * safety_factor | float) / num_osds | float) > osd_memory_target + + - name: set osd_memory_target + command: "{{ ceph_cmd }} config set osd/host:{{ inventory_hostname }} osd_memory_target {{ _osd_memory_target | default(osd_memory_target) }}" + changed_when: false + delegate_to: "{{ groups[mon_group_name][0] }}" + - name: create ceph conf directory file: path: "/etc/ceph" diff --git a/roles/ceph-config/templates/ceph.conf.j2 b/roles/ceph-config/templates/ceph.conf.j2 index 8761569f7..3d5183810 100644 --- a/roles/ceph-config/templates/ceph.conf.j2 +++ b/roles/ceph-config/templates/ceph.conf.j2 @@ -82,17 +82,6 @@ filestore xattr use omap = true {% if osd_objectstore == 'bluestore' %} {% set _num_osds = num_osds | default(0) | int %} [osd] -{% if is_hci | bool and _num_osds > 0 %} -{# hci_safety_factor is the safety factor for HCI deployments #} -{% if ansible_facts['memtotal_mb'] * 1048576 * hci_safety_factor / _num_osds > osd_memory_target %} -{% set _osd_memory_target = (ansible_facts['memtotal_mb'] * 1048576 * hci_safety_factor / _num_osds) | int %} -{% endif %} -{% elif _num_osds > 0 %} -{# non_hci_safety_factor is the safety factor for dedicated nodes #} -{% if ansible_facts['memtotal_mb'] * 1048576 * non_hci_safety_factor / _num_osds > osd_memory_target %} -{% set _osd_memory_target = (ansible_facts['memtotal_mb'] * 1048576 * non_hci_safety_factor / _num_osds) | int %} -{% endif %} -{% endif %} osd memory target = {{ _osd_memory_target | default(osd_memory_target) }} {% endif %} {% endif %} diff --git a/roles/ceph-defaults/defaults/main.yml b/roles/ceph-defaults/defaults/main.yml index 8de599a83..39dd976d9 100644 --- a/roles/ceph-defaults/defaults/main.yml +++ b/roles/ceph-defaults/defaults/main.yml @@ -350,6 +350,7 @@ lvmetad_disabled: false is_hci: false hci_safety_factor: 0.2 non_hci_safety_factor: 0.7 +safety_factor: "{{ hci_safety_factor if is_hci | bool else non_hci_safety_factor }}" osd_memory_target: 4294967296 journal_size: 5120 # OSD journal size in MB block_db_size: -1 # block db size in bytes for the ceph-volume lvm batch. -1 means use the default of 'as big as possible'.