From: Sage Weil Date: Wed, 6 Nov 2019 14:59:37 +0000 (-0600) Subject: mgr/ssh: implement blink_device_light X-Git-Tag: v15.1.0~1002^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a9b5fa6303beccdc739f886a7978c7e3ca5b9515;p=ceph.git mgr/ssh: implement blink_device_light 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 --- diff --git a/doc/mgr/orchestrator_cli.rst b/doc/mgr/orchestrator_cli.rst index 80cf9d3d2d15..8151ff8aa880 100644 --- a/doc/mgr/orchestrator_cli.rst +++ b/doc/mgr/orchestrator_cli.rst @@ -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} ⚪ ⚪ ⚪ ⚪ + device {ident,fault}-(on,off} ⚪ ⚪ ⚪ ✔ device ls ✔ ✔ ✔ ✔ service ls ⚪ ✔ ✔ ✔ service-instance status ⚪ ⚪ ⚪ ✔ diff --git a/src/pybind/mgr/ssh/module.py b/src/pybind/mgr/ssh/module.py index 336a9b75b042..b7db09e9c832 100644 --- a/src/pybind/mgr/ssh/module.py +++ b/src/pybind/mgr/ssh/module.py @@ -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