Add optional parameter "no wait for return" in panic_reboot_host #20

Merged
abereziny merged 1 commit from yadro-vavdeev/frostfs-testlib:panic_reboot_wait into master 2023-05-18 08:15:14 +00:00

View file

@ -94,13 +94,14 @@ class ClusterStateController:
@run_optionally(optionals.OPTIONAL_FAILOVER_ENABLED) @run_optionally(optionals.OPTIONAL_FAILOVER_ENABLED)
@reporter.step_deco("Hard reboot host {node} via magic SysRq option") @reporter.step_deco("Hard reboot host {node} via magic SysRq option")
def panic_reboot_host(self, node: ClusterNode): def panic_reboot_host(self, node: ClusterNode, wait_for_return: bool = True):
shell = node.host.get_shell() shell = node.host.get_shell()
shell.exec('sudo sh -c "echo 1 > /proc/sys/kernel/sysrq"') shell.exec('sudo sh -c "echo 1 > /proc/sys/kernel/sysrq"')
options = CommandOptions(close_stdin=True, timeout=1, check=False) options = CommandOptions(close_stdin=True, timeout=1, check=False)
shell.exec('sudo sh -c "echo b > /proc/sysrq-trigger"', options) shell.exec('sudo sh -c "echo b > /proc/sysrq-trigger"', options)
if wait_for_return:
# Let the things to be settled # Let the things to be settled
# A little wait here to prevent ssh stuck during panic # A little wait here to prevent ssh stuck during panic
time.sleep(10) time.sleep(10)