From 613773b2a3efcf7e9ccd562969bf8bca8c242377 Mon Sep 17 00:00:00 2001 From: Seena Fallah Date: Sat, 24 Sep 2022 19:46:20 +0200 Subject: [PATCH] ceph-config: fix overriding osd_memory_target When the value is overriding in `ceph_conf_overrides`, there is no need to calculate and set `osd_memory_target` again as we wanted to override the conf by our desired value. Signed-off-by: Seena Fallah --- roles/ceph-config/tasks/main.yml | 5 +++-- roles/ceph-config/templates/ceph.conf.j2 | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/ceph-config/tasks/main.yml b/roles/ceph-config/tasks/main.yml index fc9a90e2b..a0747950c 100644 --- a/roles/ceph-config/tasks/main.yml +++ b/roles/ceph-config/tasks/main.yml @@ -97,9 +97,9 @@ - name: set osd related config facts when: inventory_hostname in groups.get(osd_group_name, []) block: - - name: set_fact osd_memory_target, override from ceph_conf_overrides + - name: set_fact _osd_memory_target, override from ceph_conf_overrides set_fact: - osd_memory_target: "{{ item }}" + _osd_memory_target: "{{ item }}" loop: - "{{ ceph_conf_overrides.get('osd', {}).get('osd memory target', '') }}" - "{{ ceph_conf_overrides.get('osd', {}).get('osd_memory_target', '') }}" @@ -109,6 +109,7 @@ set_fact: _osd_memory_target: "{{ ((ansible_facts['memtotal_mb'] * 1048576 * safety_factor | float) / num_osds | float) | int }}" when: + - _osd_memory_target is undefined - num_osds | default(0) | int > 0 - ((ansible_facts['memtotal_mb'] * 1048576 * safety_factor | float) / num_osds | float) > (osd_memory_target | float) diff --git a/roles/ceph-config/templates/ceph.conf.j2 b/roles/ceph-config/templates/ceph.conf.j2 index 3d5183810..15d5b86c6 100644 --- a/roles/ceph-config/templates/ceph.conf.j2 +++ b/roles/ceph-config/templates/ceph.conf.j2 @@ -80,7 +80,6 @@ filestore xattr use omap = true {% endif %} {% endif %} {% if osd_objectstore == 'bluestore' %} -{% set _num_osds = num_osds | default(0) | int %} [osd] osd memory target = {{ _osd_memory_target | default(osd_memory_target) }} {% endif %}