]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: move RemoveUtil into OSDRemovalQueue
authorSebastian Wagner <sebastian.wagner@suse.com>
Fri, 8 Jan 2021 11:41:05 +0000 (12:41 +0100)
committerSebastian Wagner <sebastian.wagner@suse.com>
Thu, 14 Jan 2021 12:00:46 +0000 (13:00 +0100)
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
src/pybind/mgr/cephadm/module.py
src/pybind/mgr/cephadm/services/osd.py
src/pybind/mgr/cephadm/tests/test_cephadm.py

index 204d74bdd68e7b551e7dc4861835101cdaa1f15f..9608c9b50d492bbc390642a7113d440432af9662 100644 (file)
@@ -390,7 +390,6 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule,
         self.cache = HostCache(self)
         self.cache.load()
 
-        self.rm_util = RemoveUtil(self)
         self.to_remove_osds = OSDRemovalQueue(self)
         self.to_remove_osds.load_from_store()
 
@@ -2223,7 +2222,7 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule,
                                                 hostname=daemon.hostname,
                                                 fullname=daemon.name(),
                                                 process_started_at=datetime_now(),
-                                                remove_util=self.rm_util))
+                                                remove_util=self.to_remove_osds.rm_util))
             except NotFoundError:
                 return f"Unable to find OSDs: {osd_ids}"
 
@@ -2240,7 +2239,7 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule,
         for osd_id in osd_ids:
             try:
                 self.to_remove_osds.rm(OSD(osd_id=int(osd_id),
-                                           remove_util=self.rm_util))
+                                           remove_util=self.to_remove_osds.rm_util))
             except (NotFoundError, KeyError):
                 return f'Unable to find OSD in the queue: {osd_id}'
 
index 0b4abcb791390c181bd94f81eceee7aa13c6f35d..2ad15873f0a41a8d351b37e5351a9001c5157f12 100644 (file)
@@ -600,6 +600,7 @@ class OSDRemovalQueue(object):
     def __init__(self, mgr: "CephadmOrchestrator") -> None:
         self.mgr: "CephadmOrchestrator" = mgr
         self.osds: Set[OSD] = set()
+        self.rm_util = RemoveUtil(mgr)
 
     def process_removal_queue(self) -> None:
         """
@@ -615,7 +616,7 @@ class OSDRemovalQueue(object):
             f"for removal: {self.all_osds()}")
 
         # find osds that are ok-to-stop and not yet draining
-        ok_to_stop_osds = self.mgr.rm_util.find_osd_stop_threshold(self.idling_osds())
+        ok_to_stop_osds = self.rm_util.find_osd_stop_threshold(self.idling_osds())
         if ok_to_stop_osds:
             # start draining those
             _ = [osd.start_draining() for osd in ok_to_stop_osds]
@@ -678,7 +679,7 @@ class OSDRemovalQueue(object):
         for k, v in self.mgr.get_store_prefix('osd_remove_queue').items():
             for osd in json.loads(v):
                 logger.debug(f"Loading osd ->{osd} from store")
-                osd_obj = OSD.from_json(osd, rm_util=self.mgr.rm_util)
+                osd_obj = OSD.from_json(osd, rm_util=self.rm_util)
                 if osd_obj is not None:
                     self.osds.add(osd_obj)
 
index d06b410b17bc0234c388b6e2da62812bbd484bab..ee62093bf2886fdfc8f711d58bcc8015c05893ad 100644 (file)
@@ -513,7 +513,7 @@ class TestCephadm(object):
                                                       hostname='test',
                                                       fullname='osd.0',
                                                       process_started_at=datetime_now(),
-                                                      remove_util=cephadm_module.rm_util
+                                                      remove_util=cephadm_module.to_remove_osds.rm_util
                                                       ))
             cephadm_module.to_remove_osds.process_removal_queue()
             assert cephadm_module.to_remove_osds == OSDRemovalQueue(cephadm_module)