From c96af4bac9670ec8247edd4e6b0b0e4b5c6bbd07 Mon Sep 17 00:00:00 2001 From: Neha Ojha Date: Mon, 19 Nov 2018 06:50:02 +0000 Subject: [PATCH] osd_memory_target: standardize unit and fix calculation * The default value of osd_memory_target used by ceph is 4294967296 bytes, so use the same as ceph-ansible default. * Convert ansible_memtotal_mb to bytes to calculate osd_memory_target Signed-off-by: Neha Ojha (cherry picked from commit 10538e9a23c60c4e634226aafe0456680c5ccc6d) --- group_vars/all.yml.sample | 2 +- group_vars/rhcs.yml.sample | 2 +- roles/ceph-config/templates/ceph.conf.j2 | 8 ++++---- roles/ceph-defaults/defaults/main.yml | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/group_vars/all.yml.sample b/group_vars/all.yml.sample index c04c6490d..80a55c1c0 100644 --- a/group_vars/all.yml.sample +++ b/group_vars/all.yml.sample @@ -362,7 +362,7 @@ dummy: #is_hci: false #hci_safety_factor: 0.2 #non_hci_safety_factor: 0.7 -#osd_memory_target: 4000000000 +#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 812e38d5b..6a8a3a5a6 100644 --- a/group_vars/rhcs.yml.sample +++ b/group_vars/rhcs.yml.sample @@ -362,7 +362,7 @@ ceph_rhcs_version: 3 #is_hci: false #hci_safety_factor: 0.2 #non_hci_safety_factor: 0.7 -#osd_memory_target: 4000000000 +#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 18b7b1539..64e0be3fe 100644 --- a/roles/ceph-config/templates/ceph.conf.j2 +++ b/roles/ceph-config/templates/ceph.conf.j2 @@ -155,12 +155,12 @@ filestore xattr use omap = true {% set _num_osds = num_osds | default(0) | int %} [osd] {% if is_hci and _num_osds > 0 %} -{% if ansible_memtotal_mb * hci_safety_factor / _num_osds > osd_memory_target %} # hci_safety_factor is the safety factor for HCI deployments -{% set _osd_memory_target = (ansible_memtotal_mb * hci_safety_factor / _num_osds) %} +{% if ansible_memtotal_mb * 1048576 * hci_safety_factor / _num_osds > osd_memory_target %} # hci_safety_factor is the safety factor for HCI deployments +{% set _osd_memory_target = (ansible_memtotal_mb * 1048576 * hci_safety_factor / _num_osds) %} {% endif %} {% elif _num_osds > 0 %} -{% if ansible_memtotal_mb * non_hci_safety_factor / _num_osds > osd_memory_target %} # non_hci_safety_factor is the safety factor for dedicated nodes -{% set _osd_memory_target = (ansible_memtotal_mb * non_hci_safety_factor / _num_osds) %} +{% if ansible_memtotal_mb * 1048576 * non_hci_safety_factor / _num_osds > osd_memory_target %} # non_hci_safety_factor is the safety factor for dedicated nodes +{% set _osd_memory_target = (ansible_memtotal_mb * 1048576 * non_hci_safety_factor / _num_osds) %} {% endif %} {% endif %} osd memory target = {{ _osd_memory_target | default(osd_memory_target) }} diff --git a/roles/ceph-defaults/defaults/main.yml b/roles/ceph-defaults/defaults/main.yml index 9c167a927..e6e535f34 100644 --- a/roles/ceph-defaults/defaults/main.yml +++ b/roles/ceph-defaults/defaults/main.yml @@ -354,7 +354,7 @@ cephfs_pools: is_hci: false hci_safety_factor: 0.2 non_hci_safety_factor: 0.7 -osd_memory_target: 4000000000 +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