summaryrefslogtreecommitdiffstats
path: root/src/pybind/mgr/insights/module.py
diff options
context:
space:
mode:
authorNoah Watkins <nwatkins@redhat.com>2018-11-29 22:28:48 +0100
committerNoah Watkins <nwatkins@redhat.com>2018-11-29 22:28:56 +0100
commit2ea283da83ecc180123496bb9200e6ddd362622a (patch)
tree69e1d39d38312f73ecf2cc1b7e28051d8aa03919 /src/pybind/mgr/insights/module.py
parentpybind/mgr: add osd space utilization to insights report (diff)
downloadceph-2ea283da83ecc180123496bb9200e6ddd362622a.tar.xz
ceph-2ea283da83ecc180123496bb9200e6ddd362622a.zip
pybind/mgr: handle inconsistent api state
Signed-off-by: Noah Watkins <nwatkins@redhat.com>
Diffstat (limited to '')
-rw-r--r--src/pybind/mgr/insights/module.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/pybind/mgr/insights/module.py b/src/pybind/mgr/insights/module.py
index 9f59920f54e..21da24e11fb 100644
--- a/src/pybind/mgr/insights/module.py
+++ b/src/pybind/mgr/insights/module.py
@@ -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'] = {}