]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/devicehealth: fix daemon filtering before scraping device 36741/head
authorYaarit Hatuka <yaarit@redhat.com>
Thu, 20 Aug 2020 18:21:11 +0000 (18:21 +0000)
committerYaarit Hatuka <yaarit@redhat.com>
Thu, 20 Aug 2020 18:47:21 +0000 (18:47 +0000)
Scraping health metrics of mon devices was introduced in Nautilus, then
disabled (only in Nautilus) since the 'tell' mechanism of mons was not
reliable.
This commit fixes a bug when filtering the daemons on the device to be
scrapped (and allows scraping osd devices solely).

When:
$ ceph device scrape-health-metrics seagate_123
Error EAGAIN: device seagate_123 not claimed by any active OSD daemons

But:
$ ceph device ls
DEVICE         HOST:DEV      DAEMONS   LIFE EXPECTANCY
seagate_123 hostname:sdc osd.1

See:
Introducing the feature in Nautilus:
PR: https://github.com/ceph/ceph/pull/24151
commit: 8d786003a44313c85c038cbdc9bd9875da197ab1

Disabling the feature in Nautilus:
PR: https://github.com/ceph/ceph/pull/31446
commit: d592e56e74d94c6a05b9240fcb0031868acefbab

This issue exists only in Nautilus and does not require fixes in any other branch.

Fixes: https://tracker.ceph.com/issues/46871
Signed-off-by: Yaarit Hatuka <yaarit@redhat.com>
src/pybind/mgr/devicehealth/module.py

index 53826d094de28ec92834c4420230d93c1deffd20..9bddc66f5f33d78570d7e64940caaedcf3a2d73f 100644 (file)
@@ -351,7 +351,7 @@ class Module(MgrModule):
         r = self.get("device " + devid)
         if not r or 'device' not in r.keys():
             return -errno.ENOENT, '', 'device ' + devid + ' not found'
-        daemons = [d for d in r['device'].get('daemons', []) if not d.startswith('osd.')]
+        daemons = [d for d in r['device'].get('daemons', []) if d.startswith('osd.')]
         if not daemons:
             return (-errno.EAGAIN, '',
                     'device ' + devid + ' not claimed by any active OSD daemons')