]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: drop osdspec_affinity tracking 44075/head
authorSage Weil <sage@newdream.net>
Tue, 23 Nov 2021 18:38:50 +0000 (13:38 -0500)
committerSage Weil <sage@newdream.net>
Tue, 23 Nov 2021 18:39:43 +0000 (13:39 -0500)
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 <sage@newdream.net>
src/pybind/mgr/cephadm/module.py
src/pybind/mgr/cephadm/services/osd.py
src/pybind/mgr/cephadm/tests/fixtures.py

index aaa1610d9c9e6b54b79360fbff5ecbf7c8878c54..2185d7d27435e885b0f2b13e0d41d8ca4c2deefd 100644 (file)
@@ -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
index 347256f51d55459ed5ba667c8d08d7d15fdce9a8..c80a2b588bd771a4bd7026ac65c894b30f63ff14 100644 (file)
@@ -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
index 8254f142d5b169bf6a88a7e46d43ae741397d477..cdcf2a05281d6ad9b653286d8f694f54a8c23afc 100644 (file)
@@ -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), \