From b28bb4a730145f8964631b75389d2d4638cb0d33 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 18 Feb 2020 16:28:22 -0600 Subject: [PATCH] mgr/cephadm: fix race between check_hosts and host rm Fixes: https://tracker.ceph.com/issues/44188 Signed-off-by: Sage Weil --- 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 f812fa7c2cb0e..cb478fec81c2c 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -779,7 +779,10 @@ class CephadmOrchestrator(MgrModule, orchestrator.OrchestratorClientMixin): def _check_hosts(self): self.log.debug('_check_hosts') bad_hosts = [] - for host, v in self.inventory.items(): + hosts = self.inventory.keys() + for host in hosts: + if host not in self.inventory: + continue self.log.debug(' checking %s' % host) try: out, err, code = self._run_cephadm( -- 2.39.5