Skip to content

Commit

Permalink
Set ssh serial console alive and check kvm modules
Browse files Browse the repository at this point in the history
  • Loading branch information
Julie-CAO committed Mar 24, 2023
1 parent e1214f9 commit 94671ac
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions tests/virt_autotest/login_console.pm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ sub set_ssh_console_timeout_before_use {
select_console('root-console');
set_ssh_console_timeout('/etc/ssh/sshd_config', '28800');
reset_consoles;
select_console 'sol', await_console => 1;
select_console 'sol', await_console => 0;
send_key 'ret';
check_screen([qw(linux-login virttest-displaymanager)], 60);
save_screenshot;
Expand All @@ -49,6 +49,16 @@ sub double_check_xen_role {
save_screenshot;
}

sub check_kvm_modules {
if (script_run('lsmod | grep "^kvm\b"') == 0 and script_run('lsmod | grep -e "^kvm_intel\b" -e "^kvm_amd\b"') == 0) {
save_screenshot;
record_info("KVM", "kvm and kvm_intel/amd modules are loaded");
}
else {
die "KVM modules are not loaded!";
}
}

#Explanation for parameters introduced to facilitate offline host upgrade:
#OFFLINE_UPGRADE indicates whether host upgrade is offline which needs reboot
#the host and upgrade from installation media. Please refer to this document:
Expand Down Expand Up @@ -191,12 +201,14 @@ sub login_to_console {
send_key 'ret';
}

# Set ssh console timeout for thunderx machine
set_ssh_console_timeout_before_use if (is_remote_backend && is_aarch64 && get_var('IPMI_HW') eq 'thunderx');
# Set ssh console timeout for virt tests on ipmi backend machines
# it will make ssh serial console alive even with long time command
set_ssh_console_timeout_before_use if (is_remote_backend and is_x86_64 and get_var('VIRT_AUTOTEST', ''));
# use console based on ssh to avoid unstable ipmi
use_ssh_serial_console;
# double-check xen role for xen host
double_check_xen_role if (is_xen_host and !get_var('REBOOT_AFTER_UPGRADE'));
check_kvm_modules if is_kvm_host and !get_var('REBOOT_AFTER_UPGRADE');
}

sub run {
Expand Down

0 comments on commit 94671ac

Please sign in to comment.