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.
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'.
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()
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()
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.
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 = []