-
Notifications
You must be signed in to change notification settings - Fork 283
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[virtualization][alp] Enable core feature tests
- Loading branch information
1 parent
3ec79c8
commit ce7163e
Showing
18 changed files
with
355 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
data/virt_autotest/guest_params_xml_files/alp_kvm_hvm_x86_64_uefi_imported_disk_vnet.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
<?xml version="1.0"?> | ||
<guest> | ||
<guest_os_name>alp</guest_os_name> | ||
<guest_version>0.1</guest_version> | ||
<guest_version_major>0</guest_version_major> | ||
<guest_version_minor>1</guest_version_minor> | ||
<guest_os_word_length>64</guest_os_word_length> | ||
<guest_build></guest_build> | ||
<host_hypervisor_uri></host_hypervisor_uri> | ||
<host_virt_type>kvm</host_virt_type> | ||
<guest_virt_type>hvm</guest_virt_type> | ||
<guest_machine_type>q35</guest_machine_type> | ||
<guest_arch>x86_64</guest_arch> | ||
<guest_name></guest_name> | ||
<guest_domain_name></guest_domain_name> | ||
<guest_memory>2048,maxmemory=4096</guest_memory> | ||
<guest_vcpus>2,maxvcpus=4</guest_vcpus> | ||
<guest_cpumodel>host-model</guest_cpumodel> | ||
<guest_metadata></guest_metadata> | ||
<guest_boot_settings>uefi</guest_boot_settings> | ||
<guest_xpath></guest_xpath> | ||
<guest_installation_automation></guest_installation_automation> | ||
<guest_installation_automation_file></guest_installation_automation_file> | ||
<guest_installation_method>import</guest_installation_method> | ||
<guest_installation_extra_args></guest_installation_extra_args> | ||
<guest_installation_wait></guest_installation_wait> | ||
<guest_installation_method_others></guest_installation_method_others> | ||
<guest_installation_media></guest_installation_media> | ||
<guest_installation_fine_grained></guest_installation_fine_grained> | ||
<guest_os_variant>opensusetumbleweed</guest_os_variant> | ||
<guest_storage_path></guest_storage_path> | ||
<guest_storage_type>disk</guest_storage_type> | ||
<guest_storage_format>qcow2</guest_storage_format> | ||
<guest_storage_label>gpt</guest_storage_label> | ||
<guest_storage_size>40</guest_storage_size> | ||
<guest_storage_others>backing_store=/var/lib/libvirt/images/ALP-VM.x86_64-0.0.1-kvm-back.qcow2,backing_format=qcow2,bus=virtio,cache=none</guest_storage_others> | ||
<guest_network_type>virtual_network</guest_network_type> | ||
<guest_network_device>br123</guest_network_device> | ||
<guest_network_others></guest_network_others> | ||
<guest_netaddr>192.168.123.0/24</guest_netaddr> | ||
<guest_ipaddr></guest_ipaddr> | ||
<guest_ipaddr_static>false</guest_ipaddr_static> | ||
<guest_macaddr></guest_macaddr> | ||
<guest_virtual_network>test-virt-net</guest_virtual_network> | ||
<guest_graphics>vnc</guest_graphics> | ||
<guest_controller></guest_controller> | ||
<guest_input></guest_input> | ||
<guest_serial>pty</guest_serial> | ||
<guest_parallel></guest_parallel> | ||
<guest_channel></guest_channel> | ||
<guest_console></guest_console> | ||
<guest_hostdev></guest_hostdev> | ||
<guest_filesystem></guest_filesystem> | ||
<guest_sound></guest_sound> | ||
<guest_watchdog></guest_watchdog> | ||
<guest_video>cirrus</guest_video> | ||
<guest_smartcard></guest_smartcard> | ||
<guest_redirdev></guest_redirdev> | ||
<guest_memballoon></guest_memballoon> | ||
<guest_tpm></guest_tpm> | ||
<guest_rng></guest_rng> | ||
<guest_panic></guest_panic> | ||
<guest_memdev></guest_memdev> | ||
<guest_vsock></guest_vsock> | ||
<guest_iommu></guest_iommu> | ||
<guest_iothreads></guest_iothreads> | ||
<guest_seclabel></guest_seclabel> | ||
<guest_keywrap></guest_keywrap> | ||
<guest_cputune></guest_cputune> | ||
<guest_memtune></guest_memtune> | ||
<guest_blkiotune></guest_blkiotune> | ||
<guest_memorybacking></guest_memorybacking> | ||
<guest_features></guest_features> | ||
<guest_clock></guest_clock> | ||
<guest_power_management></guest_power_management> | ||
<guest_events></guest_events> | ||
<guest_resource></guest_resource> | ||
<guest_sysinfo>type=fwcfg,entry0.name="opt/com.coreos/config",entry0.file="/var/lib/libvirt/images/VIRT_TEST_VM_config.ign"</guest_sysinfo> | ||
<guest_qemu_command></guest_qemu_command> | ||
<guest_launchSecurity></guest_launchSecurity> | ||
<guest_autostart></guest_autostart> | ||
<guest_transient></guest_transient> | ||
<guest_destroy_on_exit></guest_destroy_on_exit> | ||
<guest_autoconsole></guest_autoconsole> | ||
<guest_noautoconsole>false</guest_noautoconsole> | ||
<guest_noreboot></guest_noreboot> | ||
<guest_default_target>graphical</guest_default_target> | ||
<guest_do_registration>false</guest_do_registration> | ||
<guest_registration_server></guest_registration_server> | ||
<guest_registration_username></guest_registration_username> | ||
<guest_registration_password></guest_registration_password> | ||
<guest_registration_extensions></guest_registration_extensions> | ||
</guest> |
94 changes: 94 additions & 0 deletions
94
.../guest_params_xml_files/sles_15_sp4_64_kvm_hvm_uefi_with_power_management_x86_64_vnet.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<?xml version="1.0"?> | ||
<guest> | ||
<guest_os_name>sles</guest_os_name> | ||
<guest_version>15-sp4</guest_version> | ||
<guest_version_major>15</guest_version_major> | ||
<guest_version_minor>4</guest_version_minor> | ||
<guest_os_word_length>64</guest_os_word_length> | ||
<guest_build>gm</guest_build> | ||
<host_hypervisor_uri></host_hypervisor_uri> | ||
<host_virt_type>kvm</host_virt_type> | ||
<guest_virt_type>hvm</guest_virt_type> | ||
<guest_machine_type></guest_machine_type> | ||
<guest_arch>x86_64</guest_arch> | ||
<guest_name></guest_name> | ||
<guest_domain_name></guest_domain_name> | ||
<guest_memory>2048,maxmemory=4096</guest_memory> | ||
<guest_vcpus>2,maxvcpus=4</guest_vcpus> | ||
<guest_cpumodel></guest_cpumodel> | ||
<guest_metadata></guest_metadata> | ||
<guest_boot_settings>uefi</guest_boot_settings> | ||
<guest_secure_boot>true</guest_secure_boot> | ||
<guest_power_management>suspend_to_mem.enabled=yes,suspend_to_disk.enabled=yes</guest_power_management> | ||
<guest_xpath>./os/boot[@dev='hd']/@order=1#./os/boot[@dev='network']/@order=2</guest_xpath> | ||
<guest_installation_automation>autoyast</guest_installation_automation> | ||
<guest_installation_automation_file>sles_15_plus_kvm_hvm_guest_graphical_x86_64.xml</guest_installation_automation_file> | ||
<guest_installation_method>location</guest_installation_method> | ||
<guest_installation_extra_args>sshd=1#sshpassword=nots3cr3t#console=ttyS0,115200n8#textmode=1#rd.debug#rd.memdebug=4#rd.udev.debug</guest_installation_extra_args> | ||
<guest_installation_wait></guest_installation_wait> | ||
<guest_installation_method_others></guest_installation_method_others> | ||
<guest_installation_media>http://openqa.suse.de/assets/repo/fixed/SLE-15-SP4-Full-x86_64-GM-Media1/</guest_installation_media> | ||
<guest_installation_fine_grained></guest_installation_fine_grained> | ||
<guest_os_variant></guest_os_variant> | ||
<guest_storage_path></guest_storage_path> | ||
<guest_storage_type>disk</guest_storage_type> | ||
<guest_storage_format>qcow2</guest_storage_format> | ||
<guest_storage_label>gpt</guest_storage_label> | ||
<guest_storage_size></guest_storage_size> | ||
<guest_storage_others></guest_storage_others> | ||
<guest_network_type>virtual_network</guest_network_type> | ||
<guest_network_device>br123</guest_network_device> | ||
<guest_network_others></guest_network_others> | ||
<guest_netaddr>192.168.123.0/24</guest_netaddr> | ||
<guest_ipaddr></guest_ipaddr> | ||
<guest_ipaddr_static>false</guest_ipaddr_static> | ||
<guest_virtual_network>test-virt-net</guest_virtual_network> | ||
<guest_macaddr></guest_macaddr> | ||
<guest_graphics>vnc</guest_graphics> | ||
<guest_controller></guest_controller> | ||
<guest_input></guest_input> | ||
<guest_serial>pty</guest_serial> | ||
<guest_parallel></guest_parallel> | ||
<guest_channel></guest_channel> | ||
<guest_console></guest_console> | ||
<guest_hostdev></guest_hostdev> | ||
<guest_filesystem></guest_filesystem> | ||
<guest_sound></guest_sound> | ||
<guest_watchdog></guest_watchdog> | ||
<guest_video>cirrus</guest_video> | ||
<guest_smartcard></guest_smartcard> | ||
<guest_redirdev></guest_redirdev> | ||
<guest_memballoon></guest_memballoon> | ||
<guest_tpm></guest_tpm> | ||
<guest_rng></guest_rng> | ||
<guest_panic></guest_panic> | ||
<guest_memdev></guest_memdev> | ||
<guest_vsock></guest_vsock> | ||
<guest_iommu></guest_iommu> | ||
<guest_iothreads></guest_iothreads> | ||
<guest_seclabel></guest_seclabel> | ||
<guest_keywrap></guest_keywrap> | ||
<guest_cputune></guest_cputune> | ||
<guest_memtune></guest_memtune> | ||
<guest_blkiotune></guest_blkiotune> | ||
<guest_memorybacking></guest_memorybacking> | ||
<guest_features></guest_features> | ||
<guest_clock></guest_clock> | ||
<guest_events></guest_events> | ||
<guest_resource></guest_resource> | ||
<guest_sysinfo></guest_sysinfo> | ||
<guest_qemu_command></guest_qemu_command> | ||
<guest_launchSecurity></guest_launchSecurity> | ||
<guest_autostart></guest_autostart> | ||
<guest_transient></guest_transient> | ||
<guest_destroy_on_exit></guest_destroy_on_exit> | ||
<guest_autoconsole>text</guest_autoconsole> | ||
<guest_noreboot></guest_noreboot> | ||
<guest_default_target>graphical</guest_default_target> | ||
<guest_do_registration>true</guest_do_registration> | ||
<guest_registration_server></guest_registration_server> | ||
<guest_registration_username>[email protected]</guest_registration_username> | ||
<guest_registration_password></guest_registration_password> | ||
<guest_registration_extensions>sle-module-legacy#sle-module-basesystem#sle-module-server-applications#sle-module-desktop-applications#sle-module-web-scripting</guest_registration_extensions> | ||
</guest> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
|
||
# Summary: virtual_network_utils: | ||
# This file provides fundamental utilities for virtual network. | ||
# Maintainer: Leon Guo <[email protected]> | ||
# Maintainer: Leon Guo <[email protected]>, [email protected] | ||
|
||
package virt_autotest::virtual_network_utils; | ||
|
||
|
@@ -32,7 +32,7 @@ our @EXPORT | |
= qw(download_network_cfg prepare_network restore_standalone destroy_standalone restart_network | ||
restore_guests restore_network destroy_vir_network restore_libvirt_default enable_libvirt_log pload_debug_log | ||
check_guest_status check_guest_module check_guest_ip save_guest_ip test_network_interface hosts_backup | ||
hosts_restore get_free_mem get_active_pool_and_available_space clean_all_virt_networks setup_vm_simple_dns_with_ip); | ||
hosts_restore get_free_mem get_active_pool_and_available_space clean_all_virt_networks setup_vm_simple_dns_with_ip get_guest_ip_from_vnet_with_mac update_simple_dns_for_all_vm); | ||
|
||
sub check_guest_ip { | ||
my ($guest, %args) = @_; | ||
|
@@ -44,17 +44,30 @@ sub check_guest_ip { | |
|
||
# ensure guest is still alive | ||
if (script_output("virsh domstate $guest") eq "running") { | ||
script_run "sed -i '/ $guest /d' /etc/hosts"; | ||
my $mac_guest = script_output("virsh domiflist $guest | grep $net | grep -oE \"[[:xdigit:]]{2}(:[[:xdigit:]]{2}){5}\""); | ||
my $syslog_cmd = "journalctl --no-pager | grep DHCPACK"; | ||
script_retry "$syslog_cmd | grep $mac_guest | grep -oE \"([0-9]{1,3}[\.]){3}[0-9]{1,3}\"", delay => 90, retry => 9, timeout => 90; | ||
my $gi_guest = script_output("$syslog_cmd | grep $mac_guest | tail -1 | grep -oE \"([0-9]{1,3}[\.]){3}[0-9]{1,3}\""); | ||
assert_script_run "echo '$gi_guest $guest # virtualization' >> /etc/hosts"; | ||
my $gi_guest = ''; | ||
if (is_alp) { | ||
$gi_guest = get_guest_ip_from_vnet_with_mac($mac_guest, $net); | ||
} else { | ||
my $syslog_cmd = "journalctl --no-pager | grep DHCPACK"; | ||
script_retry "$syslog_cmd | grep $mac_guest | grep -oE \"([0-9]{1,3}[\.]){3}[0-9]{1,3}\"", delay => 90, retry => 9, timeout => 90; | ||
$gi_guest = script_output("$syslog_cmd | grep $mac_guest | tail -1 | grep -oE \"([0-9]{1,3}[\.]){3}[0-9]{1,3}\""); | ||
} | ||
setup_vm_simple_dns_with_ip($guest, $gi_guest); | ||
script_retry("nmap $guest -PN -p ssh | grep open", delay => 30, retry => 6, timeout => 60) if ($guest =~ m/sles-11/i); | ||
die "Ping $guest failed !" if (script_retry("ping -c5 $guest", delay => 30, retry => 6, timeout => 60) ne 0); | ||
} | ||
} | ||
|
||
sub get_guest_ip_from_vnet_with_mac { | ||
my ($mac, $net) = @_; | ||
|
||
my $cmd = "virsh net-dhcp-leases $net | sed '1,2d' | grep '$mac'"; | ||
script_retry($cmd, delay => 3, retry => 20); | ||
$cmd .= " | gawk '{print \$5 }' | sed -r 's/\\\/[0-9]+//'"; | ||
return script_output($cmd); | ||
} | ||
|
||
sub check_guest_module { | ||
my ($guest, %args) = @_; | ||
my $module = $args{module}; | ||
|
@@ -75,13 +88,17 @@ sub save_guest_ip { | |
|
||
# If we don't know guest's address or the address is wrong so the guest is not responding to ICMP | ||
if (script_run("grep $guest /etc/hosts") != 0 || script_retry("ping -c3 $guest", delay => 6, retry => 30, die => 0) != 0) { | ||
script_run "sed -i '/ $guest /d' /etc/hosts"; | ||
assert_script_run "virsh domiflist $guest"; | ||
my $mac_guest = script_output("virsh domiflist $guest | grep $name | grep -oE \"[[:xdigit:]]{2}(:[[:xdigit:]]{2}){5}\""); | ||
my $syslog_cmd = is_sle('=11-sp4') ? 'grep DHCPACK /var/log/messages' : 'journalctl --no-pager | grep DHCPACK'; | ||
script_retry "$syslog_cmd | grep $mac_guest | grep -oE \"([0-9]{1,3}[\.]){3}[0-9]{1,3}\"", delay => 90, retry => 9, timeout => 90; | ||
my $gi_guest = script_output("$syslog_cmd | grep $mac_guest | tail -1 | grep -oE \"([0-9]{1,3}[\.]){3}[0-9]{1,3}\""); | ||
assert_script_run "echo '$gi_guest $guest # virtualization' >> /etc/hosts"; | ||
my $gi_guest = ''; | ||
if (is_alp) { | ||
$gi_guest = get_guest_ip_from_vnet_with_mac($mac_guest, $name); | ||
} else { | ||
my $syslog_cmd = is_sle('=11-sp4') ? 'grep DHCPACK /var/log/messages' : 'journalctl --no-pager | grep DHCPACK'; | ||
script_retry "$syslog_cmd | grep $mac_guest | grep -oE \"([0-9]{1,3}[\.]){3}[0-9]{1,3}\"", delay => 90, retry => 9, timeout => 90; | ||
$gi_guest = script_output("$syslog_cmd | grep $mac_guest | tail -1 | grep -oE \"([0-9]{1,3}[\.]){3}[0-9]{1,3}\""); | ||
} | ||
setup_vm_simple_dns_with_ip($guest, $gi_guest); | ||
script_retry("nmap $guest -PN -p ssh | grep open", delay => 30, retry => 6, timeout => 60) if ($guest =~ m/sles-11/i); | ||
die "Ping $guest failed !" if (script_retry("ping -c5 $guest", delay => 30, retry => 6, timeout => 60) ne 0); | ||
} | ||
|
@@ -96,7 +113,7 @@ sub test_network_interface { | |
my $routed = $args{routed} // 0; | ||
my $target = $args{target} // script_output("dig +short openqa.suse.de"); | ||
|
||
check_guest_ip("$guest") if (is_sle('>15') && ($isolated == 1) && get_var('VIRT_AUTOTEST')); | ||
check_guest_ip("$guest", net => $net) if ((is_sle('>15') || is_alp) && ($isolated == 1) && get_var('VIRT_AUTOTEST')); | ||
|
||
save_guest_ip("$guest", name => $net); | ||
|
||
|
@@ -246,7 +263,7 @@ sub restart_network { | |
|
||
sub restore_guests { | ||
return if get_var('INCIDENT_ID'); # QAM does not recreate guests every time | ||
my $get_vm_hostnames = "virsh list --all | grep -e sles -e opensuse | awk \'{print \$2}\'"; | ||
my $get_vm_hostnames = "virsh list --all | grep -e sles -e opensuse -e alp -i | awk \'{print \$2}\'"; | ||
my $vm_hostnames = script_output($get_vm_hostnames, 30, type_command => 0, proceed_on_failure => 0); | ||
my @vm_hostnames_array = split(/\n+/, $vm_hostnames); | ||
foreach (@vm_hostnames_array) | ||
|
@@ -293,8 +310,8 @@ sub upload_debug_log { | |
|
||
sub check_guest_status { | ||
my $wait_script = "30"; | ||
my $vm_types = "sles"; | ||
my $get_vm_hostnames = "virsh list --all | grep $vm_types | awk \'{print \$2}\'"; | ||
my $vm_types = "sles|alp"; | ||
my $get_vm_hostnames = "virsh list --all | grep -E \"$vm_types\" -i | awk \'{print \$2}\'"; | ||
my $vm_hostnames = script_output($get_vm_hostnames, $wait_script, type_command => 0, proceed_on_failure => 0); | ||
my @vm_hostnames_array = split(/\n+/, $vm_hostnames); | ||
foreach (@vm_hostnames_array) { | ||
|
@@ -323,7 +340,12 @@ sub get_active_pool_and_available_space { | |
# get some debug info about storage pool | ||
script_run 'virsh pool-list --details'; | ||
# ensure the available disk space size for active pool | ||
my $active_pool = script_output("virsh pool-list --persistent | grep -iv nvram | grep active | awk '{print \$1}'"); | ||
my $active_pool = ''; | ||
if (is_alp) { | ||
$active_pool = script_output("virsh pool-list | grep -ivE \"nvram|boot\" | grep active | awk '{print \$1}'"); | ||
} else { | ||
$active_pool = script_output("virsh pool-list --persistent | grep -iv nvram | grep active | awk '{print \$1}'"); | ||
} | ||
my $available_size = script_output("virsh pool-info $active_pool | grep ^Available | awk '{print \$2}'"); | ||
my $pool_unit = script_output("virsh pool-info $active_pool | grep ^Available | awk '{print \$3}'"); | ||
# default available pool unit as GiB | ||
|
@@ -362,4 +384,12 @@ sub setup_vm_simple_dns_with_ip { | |
record_info("Simple DNS setup in /etc/hosts for $_ip $_vm is successful!", script_output("cat /etc/hosts")); | ||
} | ||
|
||
sub update_simple_dns_for_all_vm { | ||
my $_vnet = shift; | ||
|
||
my $_cmd = "virsh list --all | grep -e sles -e opensuse -e alp -i | awk \'{print \$2}\'"; | ||
my $_vms = script_output($_cmd, 30, type_command => 0, proceed_on_failure => 0); | ||
check_guest_ip("$_", net => $_vnet) foreach (split(/\n+/, $_vms)); | ||
} | ||
|
||
1; |
Oops, something went wrong.