From 667405dc2e9feeb1153df137252945abf00929da Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Sun, 23 Feb 2020 08:32:05 -0600 Subject: [PATCH] mgr/cephadm: do not refresh device inventory on mgr restart The service inventory is more fluid and is faster to gather. We also make a time-saving assumption that we don't need to persist our cache updates when making changes because we know a mgr restart will refresh. Device inventory changes are much less frequent and slower. Let's not refresh them every restart. Signed-off-by: Sage Weil --- src/pybind/mgr/cephadm/module.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index baaecdae31e..a8b23a9bcad 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -128,10 +128,14 @@ class HostCache(): self.mgr.set_store(k, None) try: j = json.loads(v) - # we do ignore the persisted last_*_update to trigger a new - # scrape on mgr restart + if 'last_device_update' in j: + self.last_device_update[host] = datetime.datetime.strptime( + j['last_device_update'], DATEFMT) + else: + self.device_refresh_queue.append(host) + # for services, we ignore the persisted last_*_update + # and always trigger a new scrape on mgr restart. self.daemon_refresh_queue.append(host) - self.device_refresh_queue.append(host) self.daemons[host] = {} self.devices[host] = [] for name, d in j.get('daemons', {}).items(): -- 2.39.5