]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: fix smart data error
authorNizamudeen A <nia@redhat.com>
Fri, 6 May 2022 15:19:18 +0000 (20:49 +0530)
committerNizamudeen A <nia@redhat.com>
Tue, 31 May 2022 13:17:57 +0000 (18:47 +0530)
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 <nia@redhat.com>
(cherry picked from commit f38e3e96b8c32f6fb7370406b975cd88431858d8)

src/pybind/mgr/dashboard/services/ceph_service.py
src/pybind/mgr/devicehealth/module.py

index b261dc6b02b0c8d879939500e7933e63a12d7304..518ee12a2f5450526f8cb31d6adf84bf33f48108 100644 (file)
@@ -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
index 056e28208cfe7d530337d3ba6ec1d890fb8c6aa4..04986bb17b1bbf446ffe47b339a7ad90c5e52f3b 100644 (file)
@@ -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')