From: Zack Cerza Date: Wed, 24 Aug 2016 17:10:08 +0000 (-0600) Subject: Update console checking, and DRY X-Git-Tag: v11.1.1~58^2^2~121^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bf797f0b1faed137eaef20b5a37cb683f50b0bff;p=ceph.git Update console checking, and DRY Signed-off-by: Zack Cerza --- diff --git a/tasks/ceph_manager.py b/tasks/ceph_manager.py index ef26fbbd492..7f9aa789758 100644 --- a/tasks/ceph_manager.py +++ b/tasks/ceph_manager.py @@ -1908,14 +1908,17 @@ class CephManager: remote = self.find_remote('osd', osd) self.log('kill_osd on osd.{o} ' 'doing powercycle of {s}'.format(o=osd, s=remote.name)) - assert remote.console is not None, ("powercycling requested " - "but RemoteConsole is not " - "initialized. " - "Check ipmi config.") + self._assert_ipmi(remote) remote.console.power_off() else: self.ctx.daemons.get_daemon('osd', osd, self.cluster).stop() + @staticmethod + def _assert_ipmi(remote): + assert remote.console.has_ipmi_credentials, ( + "powercycling requested but RemoteConsole is not " + "initialized. Check ipmi config.") + def blackhole_kill_osd(self, osd): """ Stop osd if nothing else works. @@ -1934,10 +1937,7 @@ class CephManager: remote = self.find_remote('osd', osd) self.log('kill_osd on osd.{o} doing powercycle of {s}'. format(o=osd, s=remote.name)) - assert remote.console is not None, ("powercycling requested " - "but RemoteConsole is not " - "initialized. " - "Check ipmi config.") + self._assert_ipmi(remote) remote.console.power_on() if not remote.console.check_status(300): raise Exception('Failed to revive osd.{o} via ipmi'. @@ -1994,11 +1994,7 @@ class CephManager: remote = self.find_remote('mon', mon) self.log('kill_mon on mon.{m} doing powercycle of {s}'. format(m=mon, s=remote.name)) - assert remote.console is not None, ("powercycling requested " - "but RemoteConsole is not " - "initialized. " - "Check ipmi config.") - + self._assert_ipmi(remote) remote.console.power_off() else: self.ctx.daemons.get_daemon('mon', mon, self.cluster).stop() @@ -2012,11 +2008,7 @@ class CephManager: remote = self.find_remote('mon', mon) self.log('revive_mon on mon.{m} doing powercycle of {s}'. format(m=mon, s=remote.name)) - assert remote.console is not None, ("powercycling requested " - "but RemoteConsole is not " - "initialized. " - "Check ipmi config.") - + self._assert_ipmi(remote) remote.console.power_on() self.make_admin_daemon_dir(remote) self.ctx.daemons.get_daemon('mon', mon, self.cluster).restart() diff --git a/tasks/mds_thrash.py b/tasks/mds_thrash.py index faf1abad42e..a68eeddd06a 100644 --- a/tasks/mds_thrash.py +++ b/tasks/mds_thrash.py @@ -136,14 +136,17 @@ class MDSThrasher(Greenlet): remotes.iterkeys()) self.log('kill_mds on mds.{m} doing powercycle of {s}'. format(m=mds, s=remote.name)) - assert remote.console is not None, ("powercycling requested " - "but RemoteConsole is not " - "initialized. " - "Check ipmi config.") + self._assert_ipmi(remote) remote.console.power_off() else: self.ctx.daemons.get_daemon('mds', mds).stop() + @staticmethod + def _assert_ipmi(remote): + assert remote.console.has_ipmi_credentials, ( + "powercycling requested but RemoteConsole is not " + "initialized. Check ipmi config.") + def kill_mds_by_rank(self, rank): """ kill_mds wrapper to kill based on rank passed. @@ -161,10 +164,7 @@ class MDSThrasher(Greenlet): remotes.iterkeys()) self.log('revive_mds on mds.{m} doing powercycle of {s}'. format(m=mds, s=remote.name)) - assert remote.console is not None, ("powercycling requested " - "but RemoteConsole is not " - "initialized. " - "Check ipmi config.") + self._assert_ipmi(remote) remote.console.power_on() self.manager.make_admin_daemon_dir(self.ctx, remote) args = []