From 7d2ea494e747e1c8160a37f830bda4c163bb2b0d Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Fri, 29 Apr 2022 11:36:09 -0400 Subject: [PATCH] Ensure unresponsive OSDs still display in list It is still useful to see such dead OSDs even if they've never checked in or have not checked in for quite some time. --- client-cli/pvc/cli_lib/ceph.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/client-cli/pvc/cli_lib/ceph.py b/client-cli/pvc/cli_lib/ceph.py index d5a30dfc..65eb267b 100644 --- a/client-cli/pvc/cli_lib/ceph.py +++ b/client-cli/pvc/cli_lib/ceph.py @@ -367,10 +367,20 @@ def format_list_osd(osd_list): for osd_information in osd_list: try: - # If this happens, the node hasn't checked in fully yet, so just ignore it + # If this happens, the node hasn't checked in fully yet, so use some dummy data if osd_information["stats"]["node"] == "|": - continue + for key in osd_information["stats"].keys(): + if osd_information["stats"][key] == "|": + osd_information["stats"][key] = "N/A" + elif osd_information["stats"][key] is None: + osd_information["stats"][key] = "N/A" + for key in osd_information.keys(): + if osd_information[key] is None: + osd_information[key] = "N/A" except KeyError: + print( + f"Details for OSD {osd_information['id']} missing required keys, skipping." + ) continue # Deal with the size to human readable