From: Sage Weil Date: Tue, 4 Feb 2020 19:06:49 +0000 (-0600) Subject: mgr/cephadm: remove item from cache when removing X-Git-Tag: v15.1.1~527^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d30203a0792c39c44da7745882dec60c11da023f;p=ceph.git mgr/cephadm: remove item from cache when removing This makes the daemon disappear immediately from 'service ls', and also avoids a temporary health warning about a stray service. Signed-off-by: Sage Weil --- diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index 68a62bc47ac1..f16d966de0a3 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -1601,7 +1601,7 @@ class CephadmOrchestrator(MgrModule, orchestrator.OrchestratorClientMixin): ] + extra_args, stdin=j) self.log.debug('create_daemon code %s out %s' % (code, out)) - if not code: + if not code and host in self.service_cache: # prime cached service state with what we (should have) # just created sd = { @@ -1632,6 +1632,12 @@ class CephadmOrchestrator(MgrModule, orchestrator.OrchestratorClientMixin): host, name, 'rm-daemon', ['--name', name]) self.log.debug('_remove_daemon code %s out %s' % (code, out)) + if not code and host in self.service_cache: + # remove item from cache + data = self.service_cache[host].data + if data: + data = [d for d in data if d['name'] != name] + self.service_cache[host] = orchestrator.OutdatableData(data) self.service_cache.invalidate(host) return "Removed {} from host '{}'".format(name, host)