]> git-server-git.apps.pok.os.sepia.ceph.com Git - cephmetrics.git/commitdiff
osd: fix determination of osd type
authorPaul Cuzner <pcuzner@redhat.com>
Fri, 21 Jul 2017 22:25:17 +0000 (10:25 +1200)
committerPaul Cuzner <pcuzner@redhat.com>
Fri, 21 Jul 2017 22:25:17 +0000 (10:25 +1200)
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..

collectors/osd.py

index 7399a30edd976f03d53a1a1c8b81898fae74d6c5..e75756911f12fb154c9c973a02f1a41acb04b314 100644 (file)
@@ -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)