]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: do not refresh device inventory on mgr restart 33495/head
authorSage Weil <sage@redhat.com>
Sun, 23 Feb 2020 14:32:05 +0000 (08:32 -0600)
committerSage Weil <sage@redhat.com>
Mon, 24 Feb 2020 16:35:26 +0000 (10:35 -0600)
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 <sage@redhat.com>
src/pybind/mgr/cephadm/module.py

index baaecdae31e5b6185ddd805398398047145cb607..a8b23a9bcadbcb7eb766ea296aab34b6a2219a59 100644 (file)
@@ -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():