From 9c2b8f557ef374212b5d11464b04f443cb8d84e6 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 23 Nov 2021 13:38:50 -0500 Subject: [PATCH] mgr/cephadm: drop osdspec_affinity tracking We identify which drivespec legacy OSDs belong(ed) to by metadata they report to the mgr. Modern cephadm does this instead by looking at the 'service' property in the unit.meta file. Having cephadm query the osd metadata is expensive for large clusters, so let's avoid this and rely entirely on unit.meta. Worst case, some upgraded clusters will show OSDs as service 'osd' instead of service 'osd.whatever' for whatever drivespec created them. Signed-off-by: Sage Weil --- src/pybind/mgr/cephadm/module.py | 4 +--- src/pybind/mgr/cephadm/services/osd.py | 3 --- src/pybind/mgr/cephadm/tests/fixtures.py | 1 - 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index aaa1610d9c9..2185d7d2743 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -713,8 +713,6 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule, sd.rank = int(d['rank']) if d.get('rank') is not None else None sd.rank_generation = int(d['rank_generation']) if d.get( 'rank_generation') is not None else None - if sd.daemon_type == 'osd': - sd.osdspec_affinity = self.osd_service.get_osdspec_affinity(sd.daemon_id) if 'state' in d: sd.status_desc = d['state'] sd.status = { @@ -1924,7 +1922,7 @@ Then run the following: for h, dm in self.cache.get_daemons_with_volatile_status(): osds_to_remove = [] for name, dd in dm.items(): - if dd.daemon_type == 'osd' and (dd.service_name() == service_name or not dd.osdspec_affinity): + if dd.daemon_type == 'osd' and dd.service_name() == service_name: osds_to_remove.append(str(dd.daemon_id)) if osds_to_remove: osds_msg[h] = osds_to_remove diff --git a/src/pybind/mgr/cephadm/services/osd.py b/src/pybind/mgr/cephadm/services/osd.py index 347256f51d5..c80a2b588bd 100644 --- a/src/pybind/mgr/cephadm/services/osd.py +++ b/src/pybind/mgr/cephadm/services/osd.py @@ -349,9 +349,6 @@ class OSDService(CephService): error_ok=True) return out, err, code - def get_osdspec_affinity(self, osd_id: str) -> str: - return self.mgr.get('osd_metadata').get(osd_id, {}).get('osdspec_affinity', '') - def post_remove(self, daemon: DaemonDescription, is_failed_deploy: bool) -> None: # Do not remove the osd.N keyring, if we failed to deploy the OSD, because # we cannot recover from it. The OSD keys are created by ceph-volume and not by diff --git a/src/pybind/mgr/cephadm/tests/fixtures.py b/src/pybind/mgr/cephadm/tests/fixtures.py index 8254f142d5b..cdcf2a05281 100644 --- a/src/pybind/mgr/cephadm/tests/fixtures.py +++ b/src/pybind/mgr/cephadm/tests/fixtures.py @@ -80,7 +80,6 @@ def with_cephadm_module(module_options=None, store=None): with mock.patch("cephadm.module.CephadmOrchestrator.get_ceph_option", get_ceph_option),\ mock.patch("cephadm.services.osd.RemoveUtil._run_mon_cmd"), \ mock.patch("cephadm.module.CephadmOrchestrator.get_osdmap"), \ - mock.patch("cephadm.services.osd.OSDService.get_osdspec_affinity", return_value='test_spec'), \ mock.patch("cephadm.module.CephadmOrchestrator.remote"), \ mock.patch("cephadm.agent.CephadmAgentHelpers._request_agent_acks"), \ mock.patch("cephadm.agent.CephadmAgentHelpers._apply_agent", return_value=False), \ -- 2.39.5