From f38e3e96b8c32f6fb7370406b975cd88431858d8 Mon Sep 17 00:00:00 2001 From: Nizamudeen A Date: Fri, 6 May 2022 20:49:18 +0530 Subject: [PATCH] mgr/dashboard: fix smart data error the error in the log was this ``` "/usr/share/ceph/mgr/dashboard/services/ceph_service.py", line 253, in _get_smart_data_by_device May 06 07:38:39 occldlr750-1.occl208.lab conmon[2142938]: svc_type, svc_id = daemon.split('.') May 06 07:38:39 occldlr750-1.occl208.lab conmon[2142938]: ValueError: too many values to unpack (expected 2) ``` on the cluster, the output of `ceph device ls-by-host` looks like this ``` ceph: root@occldlr750-1 /]# ceph device ls-by-host occldlr750-1.occl208.lab DEVICE DEV DAEMONS EXPECTED FAILURE DELLBOSS_VD_cbd004c975390010 sda mon.occldlr750-1.occl208.lab WDC_WUH721818AL5204_3FGZR3JT sdda osd.20 WDC_WUH721818AL5204_3FH4315T sdbf osd.94 WDC_WUH721818AL5204_3FHP58TT sdec osd.30 WDC_WUH721818AL5204_3FHSK8HT sdu osd.78 WDC_WUH721818AL5204_3FHVTS9T sdfi osd.47 WDC_WUH721818AL5204_3FHWJE8T sdv osd.23 WDC_WUH721818AL5204_3FHXHETT sdcl osd.11 WDC_WUH721818AL5204_3FHXKP1T sdcj osd.10 ``` the first device is mon and its name is mon.occldlr750-1.occl208.lab. In our dashboard code, when fetching the smart data we have a line like this `svc_type, svc_id = daemon.split('.')` so for the mon the output of `daemon.split('.') will be ['mon', 'occldlr750-1', 'occl208', 'lab']. The svc_id gets split into three because of the split. I am changing that and giving the criteria as splitting only on the first occurence of the dot and the considering everything that comes after the dot as the svc_id of the device. Fixes: https://tracker.ceph.com/issues/55571 Signed-off-by: Nizamudeen A --- src/pybind/mgr/dashboard/services/ceph_service.py | 2 +- src/pybind/mgr/devicehealth/module.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pybind/mgr/dashboard/services/ceph_service.py b/src/pybind/mgr/dashboard/services/ceph_service.py index 233a5736dd845..dd10c97b85259 100644 --- a/src/pybind/mgr/dashboard/services/ceph_service.py +++ b/src/pybind/mgr/dashboard/services/ceph_service.py @@ -249,7 +249,7 @@ class CephService(object): # thus it is not relevant for us which daemon we are using. # NOTE: the list may contain daemons that are 'down' or 'destroyed'. for daemon in device['daemons']: - svc_type, svc_id = daemon.split('.') + svc_type, svc_id = daemon.split('.', 1) if 'osd' in svc_type: if daemon not in osd_daemons_up: continue diff --git a/src/pybind/mgr/devicehealth/module.py b/src/pybind/mgr/devicehealth/module.py index 056e28208cfe7..04986bb17b1bb 100644 --- a/src/pybind/mgr/devicehealth/module.py +++ b/src/pybind/mgr/devicehealth/module.py @@ -160,7 +160,7 @@ CREATE TABLE DeviceHealthMetrics ( self.sleep_interval = 0.0 def is_valid_daemon_name(self, who: str) -> bool: - parts = who.split('.') + parts = who.split('.', 1) if len(parts) != 2: return False return parts[0] in ('osd', 'mon') -- 2.39.5