]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: use hostname from crush map for osd memory autotuning 46514/head
authorAdam King <adking@redhat.com>
Fri, 3 Jun 2022 01:32:53 +0000 (21:32 -0400)
committerAdam King <adking@redhat.com>
Mon, 6 Jun 2022 16:51:59 +0000 (12:51 -0400)
Fixes: https://tracker.ceph.com/issues/55841
Signed-off-by: Adam King <adking@redhat.com>
src/pybind/mgr/cephadm/serve.py

index 207f3c6ba49f68a4795cd073a52793f7abe1f283..2de63019f4ee72635258164b07f162265ffb7192 100644 (file)
@@ -162,7 +162,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),
                 })
@@ -171,11 +171,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: