From fb98881ced4d2be07305673d0f97abfda6eda41d Mon Sep 17 00:00:00 2001 From: Adam King Date: Thu, 2 Jun 2022 21:32:53 -0400 Subject: [PATCH] mgr/cephadm: use hostname from crush map for osd memory autotuning Fixes: https://tracker.ceph.com/issues/55841 Signed-off-by: Adam King (cherry picked from commit 50f28aa56edd348c3816335bef3bbfaf5133ae54) --- src/pybind/mgr/cephadm/serve.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/pybind/mgr/cephadm/serve.py b/src/pybind/mgr/cephadm/serve.py index efedf3251cb1d..d7f9e6b9940d4 100644 --- a/src/pybind/mgr/cephadm/serve.py +++ b/src/pybind/mgr/cephadm/serve.py @@ -167,7 +167,7 @@ class CephadmServe: ) ret, out, err = self.mgr.mon_command({ 'prefix': 'config set', - 'who': f'osd/host:{host}', + 'who': f'osd/host:{host.split(".")[0]}', 'name': 'osd_memory_target', 'value': str(val), }) @@ -176,11 +176,15 @@ class CephadmServe: f'Unable to set osd_memory_target on {host} to {val}: {err}' ) else: - self.mgr.check_mon_command({ - 'prefix': 'config rm', - 'who': f'osd/host:{host}', - 'name': 'osd_memory_target', - }) + # if osd memory autotuning is off, we don't want to remove these config + # options as users may be using them. Since there is no way to set autotuning + # on/off at a host level, best we can do is check if it is globally on. + if self.mgr.get_foreign_ceph_option('osd', 'osd_memory_target_autotune'): + self.mgr.check_mon_command({ + 'prefix': 'config rm', + 'who': f'osd/host:{host.split(".")[0]}', + 'name': 'osd_memory_target', + }) self.mgr.cache.update_autotune(host) def _refresh_hosts_and_daemons(self) -> None: -- 2.39.5