mgr/cephadm: fix race between check_hosts and host rm
authorSage Weil <sage@redhat.com>
Tue, 18 Feb 2020 22:28:22 +0000 (16:28 -0600)
committerSage Weil <sage@redhat.com>
Wed, 19 Feb 2020 17:32:18 +0000 (11:32 -0600)
Fixes: https://tracker.ceph.com/issues/44188
Signed-off-by: Sage Weil <sage@redhat.com>
src/pybind/mgr/cephadm/module.py

index f812fa7c2cb0e17ad253a933d24806768293ea13..cb478fec81c2c7e47a9b3757d29127e9c28e0eed 100644 (file)
@@ -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(