From a8acc354dc7dc1245f5030a751f4fc5ddb689b18 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 3 May 2021 12:04:28 -0400 Subject: [PATCH] mgr/cephadm: make 'host add' idempotent Do not let prime_empty_host blow away inventory. Signed-off-by: Sage Weil --- src/pybind/mgr/cephadm/module.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index 08813a4653d..29373c9e8b8 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -1409,8 +1409,9 @@ Then run the following: 'args': [f'{k}={v}' for k, v in spec.location.items()], }) + if spec.hostname not in self.inventory: + self.cache.prime_empty_host(spec.hostname) self.inventory.add_host(spec) - self.cache.prime_empty_host(spec.hostname) self.offline_hosts_remove(spec.hostname) self.event.set() # refresh stray health check self.log.info('Added host %s' % spec.hostname)