From 1c21204760c4e28fec0f48e5a0dc83da1d6566ce Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 23 Nov 2021 18:59:28 -0500 Subject: [PATCH] mgr/cephadm: skip osd_stats check if osd removal queue is empty Signed-off-by: Sage Weil (cherry picked from commit 0bbbe5d31d834d5626c11fd9c49b572b111ead8f) --- src/pybind/mgr/cephadm/module.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index b61cc54df068..d2cc4050c4da 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -559,12 +559,15 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule, self._trigger_osd_removal() def _trigger_osd_removal(self) -> None: + remove_queue = self.to_remove_osds.as_osd_ids() + if not remove_queue: + return data = self.get("osd_stats") for osd in data.get('osd_stats', []): if osd.get('num_pgs') == 0: # if _ANY_ osd that is currently in the queue appears to be empty, # start the removal process - if int(osd.get('osd')) in self.to_remove_osds.as_osd_ids(): + if int(osd.get('osd')) in remove_queue: self.log.debug('Found empty osd. Starting removal process') # if the osd that is now empty is also part of the removal queue # start the process -- 2.47.3