Ceph module hotfix for NVMe device type when collecting SMART data
Related-PROD: PROD-36605
Change-Id: Ib8ad7d014d376293cfb292e4e1ac3e35738f6cd4
diff --git a/cfg_checker/modules/ceph/info.py b/cfg_checker/modules/ceph/info.py
index 092c1c7..9b55c3f 100644
--- a/cfg_checker/modules/ceph/info.py
+++ b/cfg_checker/modules/ceph/info.py
@@ -57,9 +57,14 @@
continue
else:
# TODO: Consider filtering out or prepare data for the table
+ _osd = _d.pop("osd_name")
+ _node_name = _d.pop("node_name")
_date = sorted(_d.keys(), reverse=True)[0]
self.ceph_info['ceph_health']['date'] = _date
self.ceph_info['ceph_health']['latest'][_n] = _d[_date]
+ self.ceph_info['ceph_health']['latest'][_n]["osd_name"] = _osd
+ self.ceph_info['ceph_health']['latest'][_n]["node_name"] = \
+ _node_name
return self.ceph_info['ceph_health']['latest']
@@ -98,14 +103,18 @@
logger_cli.info("{:45} {:<10}".format(_n, "<empty>"))
continue
- _status = _d['ata_smart_data']['self_test']['status']['passed']
+ _status = _d['smart_status']['passed']
+ if "interface_speed" in _d:
+ _speed = _d['interface_speed']['current']['string']
+ else:
+ _speed = "-"
_status = 'passed' if _status else 'failed'
logger_cli.info(
_fmt.format(
_n,
_d['device']['info_name'],
- _d['interface_speed']['current']['string'],
+ _speed,
_status,
_d['temperature']['current']
)
@@ -467,14 +476,24 @@
logger_cli.info("-> Collecting health metrics")
_health_metrics = {}
_devices = _c("ceph device ls")
- for device in _devices.splitlines():
+ _devices = _devices.splitlines()
+ _progress = Progress(len(_devices)-1)
+ _index = 1
+ for device in _devices:
_t = device.split()
_osd = _t[2]
+ _node = _t[1]
_dev = _t[0]
if _dev == "DEVICE":
continue
_metric = _cj("ceph device get-health-metrics {}".format(_dev))
- _health_metrics["{}_{}".format(_osd, _dev)] = _metric
+ _dev_name = "{}_{}".format(_osd, _dev)
+ _health_metrics[_dev_name] = _metric
+ _health_metrics[_dev_name]['node_name'] = _node
+ _health_metrics[_dev_name]['osd_name'] = _osd
+ _progress.write_progress(_index, note=_dev_name)
+ _index += 1
+ _progress.end()
self._add_ceph_info_item(
"ceph_health",
"Ceph Health Metrics",