]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/devicehealth: rename old smart module to devicehealth
authorSage Weil <sage@redhat.com>
Fri, 8 Jun 2018 14:01:27 +0000 (09:01 -0500)
committerSage Weil <sage@redhat.com>
Sat, 23 Jun 2018 22:01:29 +0000 (17:01 -0500)
Let's avoid "SMART" since it's misleading (it refers specifically to ATA).

Signed-off-by: Sage Weil <sage@redhat.com>
src/pybind/mgr/devicehealth/__init__.py [new file with mode: 0644]
src/pybind/mgr/devicehealth/module.py [new file with mode: 0644]

diff --git a/src/pybind/mgr/devicehealth/__init__.py b/src/pybind/mgr/devicehealth/__init__.py
new file mode 100644 (file)
index 0000000..4c5b97c
--- /dev/null
@@ -0,0 +1,2 @@
+
+from .module import Module
diff --git a/src/pybind/mgr/devicehealth/module.py b/src/pybind/mgr/devicehealth/module.py
new file mode 100644 (file)
index 0000000..c1434d4
--- /dev/null
@@ -0,0 +1,37 @@
+
+"""
+Device health monitoring
+"""
+
+import json
+from mgr_module import MgrModule, CommandResult
+import rados
+from threading import Event
+from datetime import datetime, timedelta, date, time
+
+class Module(MgrModule):
+    COMMANDS = [
+        {
+            "cmd": "device query-daemon-health-metrics "
+                   "name=osd_id,type=CephOsdName,req=true",
+            "desc": "Get device health metrics for a given daemon (OSD)",
+            "perm": "r"
+        },
+    ]
+
+    def handle_command(self, inbuf, cmd):
+        self.log.error("handle_command")
+
+        if cmd['prefix'] == 'device query-daemon-health-metrics':
+            result = CommandResult('')
+            self.send_command(result, 'osd', str(cmd['osd_id']), json.dumps({
+                'prefix': 'smart',
+                'format': 'json',
+            }), '')
+            r, outb, outs = result.wait()
+            return (r, outb, outs)
+
+        else:
+            # mgr should respect our self.COMMANDS and not call us for
+            # any prefix we don't advertise
+            raise NotImplementedError(cmd['prefix'])