The module provides base and helper functions for powering off or rebooting a machine under test.
prepare_system_shutdown();
Need to kill ssh connection with backends like ipmi, spvm, pvm_hmc, s390x.
For s390_zkvm or xen, assign console($vnc_console) with disable_vnc_stalls
and assign console('svirt') with stop_serial_grab
.
$vnc_console get required variable 'SVIRT_VNC_CONSOLE' before assignment.
reboot_x11();
Reboot from a desktop session and handle authentication scenarios during shutdown.
Run prepare_system_shutdown
if shutdown needs authentification.
Power off desktop.
Handle each desktop differently for kde, gnome, xfce, lxde, lxqt, enlightenment, awesome, mate, minimalx.
Work around issue with CD-ROM pop-up: bsc#1137230 and make sure that s390 SUT shutdown correctly.
handle_livecd_reboot_failure();
Handle a potential failure on a live CD related to boo#993885 that the reboot action from a desktop session does not work and we are stuck on the desktop.
power_action($action [,observe => $observe] [,keepconsole => $keepconsole] [,textmode => $textmode] [,force => boolean ]);
Executes the selected power action (e.g. poweroff, reboot).
If $observe
is set, the function expects that the specified $action
was already executed by another actor and the function just makes sure the system shuts down, restarts etc. properly.
$keepconsole
prevents a console change, which we do by default to make sure that a system with a GUI desktop which was in text console at the time of power_action
call, is switched to the expected console, that is 'root-console' for textmode, 'x11' otherwise. The actual execution happens in a shell for textmode or with GUI commands otherwise unless explicitly overridden by setting $textmode
to either 0 or 1. $force
sets force option to reboot command in textmode.
assert_shutdown_and_restore_system($action, $shutdown_timeout);
VNC connection to SUT (the 'sut' console) is terminated on Xen via svirt backend and we have to re-connect *after* the restart, otherwise we end up with stalled VNC connection. The tricky part is to know *when* the system is already booting.
Default $action is reboot, $shutdown_timeout is timeout for shutdown, default value is 60 seconds.
assert_shutdown_with_soft_timeout([$args]);
$args = {[timeout => $timeout] [,soft_timeout => $soft_timeout] [,bugref => $bugref] [,soft_failure_reason => $soft_failure_reason]}
Extending assert_shutdown with a soft timeout. When $args-
{soft_timeout}> is reached, a soft failure is recorded with the message $args-
{soft_failure_reason}>.
After that, assert_shutdown continues until the (hard) timeout $args-
{timeout}> is hit.
This makes sense when a shutdown sporadically takes longer then it normally should take and the proper statistics of such cases should be gathered instead of just increasing a timeout.
If $args-
{soft_timeout}> is not specified, then the default assert_shutdown is executed.
Example:
assert_shutdown_with_soft_timeout({timeout => 300, soft_timeout => 60, bugref => 'bsc#123456'});
Validate dependencies which provides shutdown/poweroff/reboot commands.
Use this in the post_fail_hook to raise a softfail of the reported bug.