From 9858d61a57c32bac788020321c74b073c8fa2eba Mon Sep 17 00:00:00 2001 From: Dimitri Savineau Date: Wed, 9 Dec 2020 14:02:45 -0500 Subject: [PATCH] Revert "config: Always use osd_memory_target if set" This reverts commit 4d1fdd2b05d55f8028fb5593d41fa61dbddd7095. This breaks the backward compatibility with previous osd_memory_target calculation and we could have a value lower than the minimum value allowed (896M) which causes some ceph commands to fail (like ceph assimilate-conf). Signed-off-by: Dimitri Savineau (cherry picked from commit aa6e1f20eaa5272ff0bb5e8b3cded16273aa120c) --- group_vars/all.yml.sample | 4 +--- group_vars/rhcs.yml.sample | 4 +--- roles/ceph-config/templates/ceph.conf.j2 | 10 ++++++---- roles/ceph-defaults/defaults/main.yml | 4 +--- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/group_vars/all.yml.sample b/group_vars/all.yml.sample index df8c63c90..b6f365d8d 100644 --- a/group_vars/all.yml.sample +++ b/group_vars/all.yml.sample @@ -368,12 +368,10 @@ dummy: ## OSD options # -# Variables to calculate a suitable osd_memory_target based on the number of OSDs #is_hci: false #hci_safety_factor: 0.2 #non_hci_safety_factor: 0.7 -# You can also set an explicit value which will override the calculation if set. -# osd_memory_target: 4294967296 +#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'. #public_network: 0.0.0.0/0 diff --git a/group_vars/rhcs.yml.sample b/group_vars/rhcs.yml.sample index 4cfdad748..1134e010f 100644 --- a/group_vars/rhcs.yml.sample +++ b/group_vars/rhcs.yml.sample @@ -368,12 +368,10 @@ ceph_iscsi_config_dev: false ## OSD options # -# Variables to calculate a suitable osd_memory_target based on the number of OSDs #is_hci: false #hci_safety_factor: 0.2 #non_hci_safety_factor: 0.7 -# You can also set an explicit value which will override the calculation if set. -# osd_memory_target: 4294967296 +#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'. #public_network: 0.0.0.0/0 diff --git a/roles/ceph-config/templates/ceph.conf.j2 b/roles/ceph-config/templates/ceph.conf.j2 index 6773230ac..5bdc641aa 100644 --- a/roles/ceph-config/templates/ceph.conf.j2 +++ b/roles/ceph-config/templates/ceph.conf.j2 @@ -90,16 +90,18 @@ 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 and not osd_memory_target is defined %} +{% if is_hci | bool and _num_osds > 0 %} {# hci_safety_factor is the safety factor for HCI deployments #} +{% if ansible_memtotal_mb * 1048576 * hci_safety_factor / _num_osds > osd_memory_target %} {% set _osd_memory_target = (ansible_memtotal_mb * 1048576 * hci_safety_factor / _num_osds) | int %} -{% elif _num_osds > 0 and not osd_memory_target is defined %} +{% endif %} +{% elif _num_osds > 0 %} {# non_hci_safety_factor is the safety factor for dedicated nodes #} +{% if ansible_memtotal_mb * 1048576 * non_hci_safety_factor / _num_osds > osd_memory_target %} {% set _osd_memory_target = (ansible_memtotal_mb * 1048576 * non_hci_safety_factor / _num_osds) | int %} {% endif %} -{% if _osd_memory_target is defined or osd_memory_target is defined %} -osd memory target = {{ _osd_memory_target | default(osd_memory_target) }} {% 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 5ab595f10..c70849755 100644 --- a/roles/ceph-defaults/defaults/main.yml +++ b/roles/ceph-defaults/defaults/main.yml @@ -360,12 +360,10 @@ cephfs_pools: ## OSD options # -# Variables to calculate a suitable osd_memory_target based on the number of OSDs is_hci: false hci_safety_factor: 0.2 non_hci_safety_factor: 0.7 -# You can also set an explicit value which will override the calculation if set. -# osd_memory_target: 4294967296 +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'. public_network: 0.0.0.0/0 -- 2.39.5