]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/ssh: implement blink_device_light 31438/head
authorSage Weil <sage@redhat.com>
Wed, 6 Nov 2019 14:59:37 +0000 (08:59 -0600)
committerSage Weil <sage@redhat.com>
Thu, 7 Nov 2019 13:56:23 +0000 (07:56 -0600)
On my test box I get as far as

  NO_SUPPORT(153): SCSI VPD page 0x83 is not supported

because my hardware doesn't support this.  The same command works
on another box that does.

Signed-off-by: Sage Weil <sage@redhat.com>
doc/mgr/orchestrator_cli.rst
src/pybind/mgr/ssh/module.py

index 80cf9d3d2d1540daf4e16b8a96a85e7890103a06..8151ff8aa88002b4245a1a1807ed910f03b6c142 100644 (file)
@@ -302,7 +302,7 @@ This is an overview of the current implementation status of the orchestrators.
  osd create                          ✔         ✔       ⚪         ✔
  osd device {ident,fault}-{on,off}   ⚪         ⚪       ⚪         ⚪
  osd rm                              ✔         ⚪       ⚪         ✔
- device {ident,fault}-(on,off}       â\9aª         â\9aª       â\9aª         â\9aª
+ device {ident,fault}-(on,off}       â\9aª         â\9aª       â\9aª         â\9c\94
  device ls                           ✔         ✔       ✔         ✔
  service ls                          ⚪         ✔       ✔         ✔
  service-instance status             ⚪         ⚪       ⚪         ✔
index 336a9b75b0426da573bfcc6754114b68fee086b0..b7db09e9c832cb32187914669c073872d2d68039 100644 (file)
@@ -649,6 +649,33 @@ class SSHOrchestrator(MgrModule, orchestrator.OrchestratorClientMixin):
 
         return SSHReadCompletion(results)
 
+    @log_exceptions
+    def blink_device_light(self, ident_fault, on, locs):
+        def blink(host, dev, ident_fault, on):
+            cmd = [
+                'lsmcli',
+                'local-disk-%s-led-%s' % (
+                    ident_fault,
+                    'on' if on else 'off'),
+                '--path', '/dev/' + dev,
+            ]
+            out, code = self._run_ceph_daemon(host, 'osd', 'shell', ['--'] + cmd,
+                                              error_ok=True)
+            if code:
+                raise RuntimeError(
+                    'Unable to affect %s light for %s:%s. Command: %s' % (
+                        ident_fault, host, dev, ' '.join(cmd)))
+            return "Set %s light for %s:%s %s" % (
+                ident_fault, host, dev, 'on' if on else 'off')
+
+        results = []
+        for loc in locs:
+            results.append(
+                self._worker_pool.apply_async(
+                    blink,
+                    (loc.host, loc.dev, ident_fault, on)))
+        return SSHWriteCompletion(results)
+
     @log_exceptions
     def _create_osd(self, host, drive_group):
         # get bootstrap key