From: Paul Cuzner Date: Fri, 21 Jul 2017 22:25:17 +0000 (+1200) Subject: osd: fix determination of osd type X-Git-Tag: v1.0~40^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=389a00ef432fbb0b16f412aefeed804cd90d9d9e;p=cephmetrics.git osd: fix determination of osd type the presence of the type file was being relied upon across versions. However, not all versions show this file (10.2.2 did, 10.2.7 didn't!), so this fix looks for type and if it's there it uses it, if not it will look for the presence of the journal link to determine if the osd is filestore. It is assumed that bluestore will 'always' use the type file.. --- diff --git a/collectors/osd.py b/collectors/osd.py index 7399a30..e757569 100644 --- a/collectors/osd.py +++ b/collectors/osd.py @@ -121,6 +121,18 @@ class OSDs(BaseCollector): return stats + @staticmethod + def get_osd_type(osd_path): + + osd_type_fname = os.path.join(osd_path, 'type') + if os.path.exists(osd_type_fname): + return fread(osd_type_fname) + else: + if os.path.exists(os.path.join(osd_path, 'journal')): + return "filestore" + else: + raise ValueError("Unrecognised OSD type") + def _dev_to_osd(self): """ Look at the system to determine which disks are acting as OSD's @@ -151,8 +163,7 @@ class OSDs(BaseCollector): osd_id = fread(os.path.join(path_name, 'whoami')) if osd_id not in self.osd: - - osd_type = fread(os.path.join(path_name, "type")) + osd_type = OSDs.get_osd_type(path_name) self.osd[osd_id] = OSDstats(osd_type=osd_type) self.osd_id_list.append(osd_id)