From: Sage Weil Date: Sun, 23 Feb 2020 14:32:05 +0000 (-0600) Subject: mgr/cephadm: do not refresh device inventory on mgr restart X-Git-Tag: v15.1.1~271^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=667405dc2e9feeb1153df137252945abf00929da;p=ceph-ci.git 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 --- 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():