Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support vgpu automation test #19718

Merged
merged 1 commit into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<gfxmode>auto</gfxmode>
<hiddenmenu>false</hiddenmenu>
<os_prober>false</os_prober>
<serial>serial --speed=115200 --unit=<%= $get_var->('SERIALDEV') =~ s/ttyS//r %> --word=8 --parity=no --stop=1</serial>
<serial>serial --speed=115200 --unit=<%= $get_var->('SERIALDEV', 'ttyS1') =~ s/ttyS//r %> --word=8 --parity=no --stop=1</serial>
<timeout config:type="integer">15</timeout>
<trusted_grub>false</trusted_grub>
<secure_boot>false</secure_boot>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@
<hiddenmenu>false</hiddenmenu>
<os_prober>false</os_prober>
<secure_boot>false</secure_boot>
<serial>serial --speed=115200 --unit=<%= $get_var->('SERIALDEV') =~ s/ttyS//r %> --word=8 --parity=no --stop=1</serial>
<serial>serial --speed=115200 --unit=<%= $get_var->('SERIALDEV', 'ttyS1') =~ s/ttyS//r %> --word=8 --parity=no --stop=1</serial>
<timeout config:type="integer">15</timeout>
<trusted_grub>false</trusted_grub>
<terminal>console</terminal>
% if ($check_var->('SYSTEM_ROLE', 'xen')) {
<xen_append>splash=silent quiet console=tty <%= defined $bmwqemu::vars{"ENABLE_CONSOLE_KERNEL_LOG"} ? "loglvl=all guest_loglvl=all" : "loglvl=debug guest_loglvl=debug" %> <%= defined $bmwqemu::vars{"OPT_KERNEL_PARAMS"} ? $bmwqemu::vars{"OPT_KERNEL_PARAMS"} : "" %></xen_append>
<xen_append>splash=silent quiet console=tty <%= defined $bmwqemu::vars{"ENABLE_CONSOLE_KERNEL_LOG"} ? "loglvl=all guest_loglvl=all" : "loglvl=debug guest_loglvl=debug" %> <%= $get_var->('OPT_KERNEL_PARAMS') %></xen_append>
<!-- For some special beremetal machines, such as unreal2/3, their serial console:
SERIALDEV='ttyS2', XEN_SERIAL_CONSOLE="com1=115200,8n1,0x3e8,5 console=com1" -->
<xen_kernel_append><%= defined $bmwqemu::vars{"XEN_SERIAL_CONSOLE"} ? $bmwqemu::vars{"XEN_SERIAL_CONSOLE"} : "console=com2,115200" %> vga=gfx-1024x768x16 <%= defined $bmwqemu::vars{"ENABLE_CONSOLE_KERNEL_LOG"} ? "loglvl=all guest_loglvl=all" : "loglvl=debug guest_loglvl=debug" %> sync_console</xen_kernel_append>
Expand All @@ -64,15 +64,15 @@
% if ($check_var->('VIRT_SEV_ES_GUEST_INSTALL', '1')) {
<!-- Do not add mem_encrypt=on option on 15-SP6 KVM host due to bsc#1224107 -->
% if ($check_var->('VERSION', '15-SP6')) {
<append>splash=silent console=<%= $get_var->('SERIALDEV') %>,115200 console=tty kvm_amd.sev=1 <%= defined $bmwqemu::vars{"ENABLE_CONSOLE_KERNEL_LOG"} ? "ignore_loglevel" : "loglevel=5" %> <%= defined $bmwqemu::vars{"OPT_KERNEL_PARAMS"} ? $bmwqemu::vars{"OPT_KERNEL_PARAMS"} : "" %></append>
<append>splash=silent console=<%= $get_var->('SERIALDEV', 'ttyS1') %>,115200 console=tty kvm_amd.sev=1 <%= defined $bmwqemu::vars{"ENABLE_CONSOLE_KERNEL_LOG"} ? "ignore_loglevel" : "loglevel=5" %> <%= $get_var->('OPT_KERNEL_PARAMS') %></append>
% } else {
<append>splash=silent console=<%= $get_var->('SERIALDEV') %>,115200 console=tty mem_encrypt=on kvm_amd.sev=1 <%= defined $bmwqemu::vars{"ENABLE_CONSOLE_KERNEL_LOG"} ? "ignore_loglevel" : "loglevel=5" %> <%= defined $bmwqemu::vars{"OPT_KERNEL_PARAMS"} ? $bmwqemu::vars{"OPT_KERNEL_PARAMS"} : "" %></append>
<append>splash=silent console=<%= $get_var->('SERIALDEV', 'ttyS1') %>,115200 console=tty mem_encrypt=on kvm_amd.sev=1 <%= defined $bmwqemu::vars{"ENABLE_CONSOLE_KERNEL_LOG"} ? "ignore_loglevel" : "loglevel=5" %> <%= $get_var->('OPT_KERNEL_PARAMS') %></append>
% }
% } else {
<append>splash=silent console=<%= $get_var->('SERIALDEV') %>,115200 console=tty <%= defined $bmwqemu::vars{"ENABLE_CONSOLE_KERNEL_LOG"} ? "ignore_loglevel" : "loglevel=5" %> <%= defined $bmwqemu::vars{"OPT_KERNEL_PARAMS"} ? $bmwqemu::vars{"OPT_KERNEL_PARAMS"} : "" %></append>
<append>splash=silent console=<%= $get_var->('SERIALDEV', 'ttyS1') %>,115200 console=tty <%= defined $bmwqemu::vars{"ENABLE_CONSOLE_KERNEL_LOG"} ? "ignore_loglevel" : "loglevel=5" %> <%= $get_var->('OPT_KERNEL_PARAMS') %></append>
% }
% } else {
<append>splash=silent console=<%= $get_var->('SERIALDEV') %>,115200 console=tty intel_iommu=on <%= defined $bmwqemu::vars{"ENABLE_CONSOLE_KERNEL_LOG"} ? "ignore_loglevel" : "loglevel=5" %> <%= defined $bmwqemu::vars{"OPT_KERNEL_PARAMS"} ? $bmwqemu::vars{"OPT_KERNEL_PARAMS"} : "" %></append>
<append>splash=silent console=<%= $get_var->('SERIALDEV', 'ttyS1') %>,115200 console=tty intel_iommu=on <%= defined $bmwqemu::vars{"ENABLE_CONSOLE_KERNEL_LOG"} ? "ignore_loglevel" : "loglevel=5" %> <%= $get_var->('OPT_KERNEL_PARAMS') %></append>
% }
% }
</global>
Expand Down Expand Up @@ -278,6 +278,19 @@
</user>
</users>
<scripts>
<chroot-scripts config:type="list">
<script>
<!-- Keep ssh connection alive for long-time run test -->
<chrooted t="boolean">true</chrooted>
<filename>configure_sshd.sh</filename>
<interpreter>/bin/bash -x</interpreter>
<source><![CDATA[
sshd_config_file="/etc/ssh/sshd_config.d/01-virt-test.conf"
echo -e "TCPKeepAlive yes\nClientAliveInterval 60\nClientAliveCountMax 60" > $sshd_config_file
]]>
</source>
</script>
</chroot-scripts>
<post-scripts config:type="list">
% if ($check_var->('SYSTEM_ROLE', 'xen') && $check_var->('XEN_DEFAULT_BOOT_IS_SET', 1)) {
<script>
Expand Down
11 changes: 11 additions & 0 deletions data/virt_autotest/vgpu_guest_logging.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash -x
#vgpu test guest debugging
date
echo ""
lspci
echo ""
lsmod | grep -i -e nvidia -e kvm
echo ""
nvidia-smi
echo ""
journalctl --cursor-file /tmp/cursor.txt | grep -i -e 'kernel:' -e nvidia
4 changes: 2 additions & 2 deletions lib/ipmi_backend_utils.pm
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ sub setup_console_in_grub {
elsif (${virt_type} eq "kvm") {
#enable Intel VT-d for SR-IOV test running on intel SUTs
my $intel_option = "";
if (get_var("ENABLE_SRIOV_NETWORK_CARD_PCI_PASSTHROUGH") && script_run("grep Intel /proc/cpuinfo") == 0) {
$intel_option = "intel_iommu=on";
if (get_var("ENABLE_SRIOV_NETWORK_CARD_PCI_PASSTHROUGH") or get_var("VGPU_TEST")) {
$intel_option = "intel_iommu=on" if script_run("grep Intel /proc/cpuinfo") == 0;
}

$cmd
Expand Down
29 changes: 23 additions & 6 deletions lib/virt_autotest/utils.pm
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ use Utils::Architectures;
use IO::Socket::INET;
use Carp;

our @EXPORT = qw(is_vmware_virtualization is_hyperv_virtualization is_fv_guest is_pv_guest guest_is_sle is_guest_ballooned is_xen_host is_kvm_host reset_log_cursor check_failures_in_journal check_host_health check_guest_health
is_monolithic_libvirtd turn_on_libvirt_debugging_log
print_cmd_output_to_file ssh_setup ssh_copy_id create_guest import_guest install_default_packages ensure_default_net_is_active ensure_guest_started
ensure_online add_guest_to_hosts restart_libvirtd check_libvirtd remove_additional_disks remove_additional_nic collect_virt_system_logs shutdown_guests wait_guest_online start_guests restore_downloaded_guests save_original_guest_xmls restore_original_guests save_guests_xml_for_change restore_xml_changed_guests
is_guest_online wait_guests_shutdown remove_vm setup_common_ssh_config add_alias_in_ssh_config parse_subnet_address_ipv4 backup_file manage_system_service setup_rsyslog_host
check_port_state is_registered_system do_system_registration check_system_registration subscribe_extensions_and_modules download_script download_script_and_execute is_sev_es_guest upload_virt_logs recreate_guests download_vm_import_disks enable_nm_debug check_activate_network_interface upload_nm_debug_log restart_modular_libvirt_daemons check_modular_libvirt_daemons get_guest_regcode);
our @EXPORT = qw(is_vmware_virtualization is_hyperv_virtualization is_fv_guest is_pv_guest is_sev_es_guest guest_is_sle is_guest_ballooned is_xen_host is_kvm_host
is_monolithic_libvirtd turn_on_libvirt_debugging_log restart_libvirtd check_libvirtd restart_modular_libvirt_daemons check_modular_libvirt_daemons
reset_log_cursor check_failures_in_journal check_host_health check_guest_health print_cmd_output_to_file collect_virt_system_logs setup_rsyslog_host download_script download_script_and_execute upload_virt_logs enable_nm_debug upload_nm_debug_log
ssh_setup setup_common_ssh_config add_alias_in_ssh_config install_default_packages parse_subnet_address_ipv4 backup_file manage_system_service check_port_state is_registered_system do_system_registration check_system_registration subscribe_extensions_and_modules check_activate_network_interface wait_for_host_reboot
create_guest import_guest ssh_copy_id add_guest_to_hosts ensure_default_net_is_active ensure_guest_started remove_additional_disks remove_additional_nic start_guests is_guest_online ensure_online wait_guest_online restore_downloaded_guests save_original_guest_xmls restore_original_guests save_guests_xml_for_change restore_xml_changed_guests shutdown_guests wait_guests_shutdown remove_vm recreate_guests download_vm_import_disks get_guest_regcode
);

my %log_cursors;

Expand Down Expand Up @@ -1274,4 +1274,21 @@ sub get_guest_regcode {
return $regcode, $regcode_ltss;
}

sub wait_for_host_reboot {
select_console 'sol', await_console => 0;
# Wait for reboot and show screenshots
foreach (1 .. 10) {
save_screenshot;
sleep 20;
}
assert_screen([qw(sol-console-wait-typing-ret linux-login text-login)], 120);
if (match_has_tag('sol-console-wait-typing-ret')) {
send_key 'ret';
assert_screen([qw(inux-login text-login)], 120);
}
record_info("Host rebooted");
reset_consoles;
select_console('root-ssh');
}

1;
1 change: 1 addition & 0 deletions products/sle/main.pm
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,7 @@ sub load_virt_feature_tests {
}
loadtest "virt_autotest/xen_guest_irqbalance" if get_var("ENABLE_XEN_GUEST_IRQBALANCE");
loadtest "virt_autotest/sriov_network_card_pci_passthrough" if get_var("ENABLE_SRIOV_NETWORK_CARD_PCI_PASSTHROUGH");
loadtest "virt_autotest/vgpu" if get_var("VGPU_TEST");
if (get_var('ENABLE_HOTPLUGGING')) {
loadtest 'virtualization/universal/hotplugging_guest_preparation';
loadtest 'virtualization/universal/hotplugging_network_interfaces';
Expand Down
40 changes: 6 additions & 34 deletions tests/virt_autotest/install_package.pm
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use Utils::Architectures;
use version_utils qw(is_sle);
use virt_utils;
use utils;
use Utils::Backends 'is_remote_backend';
use Utils::Backends qw(use_ssh_serial_console is_remote_backend);
use virt_autotest::utils qw(is_xen_host subscribe_extensions_and_modules);

sub install_package {
Expand All @@ -36,39 +36,6 @@ sub install_package {
zypper_call("--no-gpg-checks ar -f '$qa_server_repo' server-repo");
}

#workaround for dependency on xmlstarlet for qa_lib_virtauto on sles11sp4 and sles12sp1
#workaround for dependency on bridge-utils for qa_lib_virtauto on sles15sp0
my $repo_0_to_install = get_var("REPO_0_TO_INSTALL", '');
my $dependency_repo = '';
my $dependency_rpms = '';
if ($repo_0_to_install =~ /SLES-11-SP4/m) {
$dependency_repo = 'http://download.suse.de/ibs/SUSE:/SLE-11:/Update/standard/';
$dependency_rpms = 'xmlstarlet';
}
elsif ($repo_0_to_install =~ /SLE-12-SP1/m) {
$dependency_repo = 'http://download.suse.de/ibs/SUSE:/SLE-12:/Update/standard/';
$dependency_rpms = 'xmlstarlet';
}
elsif ($repo_0_to_install =~ /SLE-15-Installer/m) {
$dependency_repo = 'http://download.suse.de/ibs/SUSE:/SLE-15:/GA/standard/';
$dependency_rpms = 'bridge-utils';
}

if ($dependency_repo) {
if (is_s390x) {
lpar_cmd("zypper --non-interactive --no-gpg-checks ar -f ${dependency_repo} dependency_repo");
lpar_cmd("zypper --non-interactive --gpg-auto-import-keys ref");
lpar_cmd("zypper --non-interactive in $dependency_rpms");
lpar_cmd("zypper --non-interactive rr dependency_repo");
}
else {
zypper_call("--no-gpg-checks ar -f ${dependency_repo} dependency_repo");
zypper_call("--gpg-auto-import-keys ref", 180);
zypper_call("in $dependency_rpms");
zypper_call("rr dependency_repo");
}
}

#Install KVM role patterns for aarch64 virtualization host
if (is_remote_backend && is_aarch64) {
zypper_call("--gpg-auto-import-keys ref", timeout => 180);
Expand Down Expand Up @@ -119,6 +86,11 @@ sub install_package {
}

sub run {
# Only for x86_64
if (is_x86_64) {
select_console 'sol', await_console => 0;
use_ssh_serial_console;
}
install_package;
}

Expand Down
4 changes: 2 additions & 2 deletions tests/virt_autotest/login_console.pm
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,8 @@ sub login_to_console {

# Set ssh console timeout for virt tests on ipmi backend machines
# it will make ssh serial console alive even with long time command
# For TW hosts, sshd configurations have been created in its autoyast profiles
if (is_remote_backend and is_x86_64 and get_var('VIRT_AUTOTEST', '')) {
# For SLE15 and TW autoyast installation, sshd configurations have been created in its autoyast profiles
if (is_remote_backend and is_x86_64 and get_var('VIRT_AUTOTEST') and !(is_sle('15+') and get_var('AUTOYAST'))) {
if (is_sle) {
set_ssh_console_timeout_before_use;
}
Expand Down
Loading
Loading