]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/mgr: handle inconsistent api state 25122/head
authorNoah Watkins <nwatkins@redhat.com>
Thu, 29 Nov 2018 21:28:48 +0000 (13:28 -0800)
committerNoah Watkins <nwatkins@redhat.com>
Thu, 29 Nov 2018 21:28:56 +0000 (13:28 -0800)
Signed-off-by: Noah Watkins <nwatkins@redhat.com>
src/pybind/mgr/insights/module.py

index 9f59920f54e13b9f91bcd059f870e48440eea74c..21da24e11fb0bea6e161d2194d0172c7921d2b7d 100644 (file)
@@ -209,8 +209,11 @@ class Module(MgrModule):
         # include stats, including space utilization performance counters.
         # adapted from dashboard api controller
         for s in self.get('osd_stats')['osd_stats']:
-            idx = osd_id_to_idx[s["osd"]]
-            osd_map["osds"][idx].update({'osd_stats': s})
+            try:
+                idx = osd_id_to_idx[s["osd"]]
+                osd_map["osds"][idx].update({'osd_stats': s})
+            except KeyError as e:
+                self.log.warning("inconsistent api state: {}".format(str(e)))
 
         for osd in osd_map["osds"]:
             osd['stats'] = {}