-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
guest_os_booting: update tests for s390x
The following features are not available on s390x: * SMBIOS * ACPI * fw_cfg * USB * <boot dev.../> * firmware settings * SATA For direct kernel boot, don't use hard coded kernel filename. In our setup we'll use kernel.img, so just use the filename from the download url. Don't use ttyS0, it's the line mode console which is not useful. Using ttysclp0 is the standard on s390x. Cover also s390x-specific parameter @loadparm by allowing generically to run a test command in the booted VM whose output should match an expected regular expression. On s390x, the VM will stop if no bootable medium - such as missing cdrom file - is found. Some tests were written assuming the VM would use the //os/boot element instead of the per-device element by trying to remove only that element. Instead just remove all present boot elements in these cases, no matter where, the test will define the new one that's relevant for the test case. In some boot tests also enable boot for VMs without Secure Boot, where there's no firmware. Add test case that attaches same bootable device twice, this had a bug on s390x recently. s390x currently doesn't have secure boot. Use the first VM and don't set os attributes that relate to secure boot on other archs. Implement logic to actually load into the installer via PXE. Move s390x PXE setup to provider for reuse in boot order tests. Allow for pxelinux.cfg without kickstart, for the boot check we don't need it. Also, a network boot requires more RAM, so update if configured. Signed-off-by: Sebastian Mitterle <[email protected]>
- Loading branch information
Showing
17 changed files
with
237 additions
and
90 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
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
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
1 change: 1 addition & 0 deletions
1
libvirt/tests/cfg/guest_os_booting/firmware_configuration/smbios_mode.cfg
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
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 |
---|---|---|
@@ -1,8 +1,9 @@ | ||
# Copyright Red Hat | ||
# SPDX-License-Identifier: GPL-2.0 | ||
# Author: Meina Li <[email protected]> | ||
|
||
import platform | ||
import os | ||
import re | ||
|
||
from avocado.utils import process | ||
|
||
|
@@ -13,6 +14,7 @@ | |
from virttest.utils_test import libvirt | ||
|
||
from provider.guest_os_booting import guest_os_booting_base as guest_os | ||
from provider.virtual_network import tftpboot | ||
|
||
# Prepare a list to record the file path which need to be removed | ||
file_list = [] | ||
|
@@ -33,6 +35,8 @@ def prepare_device_attrs(test, params, vm_name, bootable_device): | |
disk_order = eval(params.get("disk_order", "{}")) | ||
cdrom_order = eval(params.get("cdrom_order", "{}")) | ||
network_order = eval(params.get("network_order", "{}")) | ||
set_up_tftp = "yes" == params.get("set_up_tftp", "no") | ||
memory = params.get("vm_memory", "") | ||
disk_image = os.path.join(data_dir.get_data_dir(), 'images', 'test.img') | ||
vmxml = guest_os.prepare_os_xml(vm_name, os_dict) | ||
vmxml.remove_all_boots() | ||
|
@@ -51,11 +55,20 @@ def prepare_device_attrs(test, params, vm_name, bootable_device): | |
else: | ||
cdrom_path = os.path.join(data_dir.get_data_dir(), 'images', 'test.iso') | ||
libvirt.create_local_disk("file", path=cdrom_path, size="500M", disk_format="raw") | ||
if bootable_device == "network_bootable" and set_up_tftp: | ||
install_tree_url = params.get("install_tree_url") | ||
tftpboot.create_tftp_content(install_tree_url, | ||
None, | ||
arch=platform.machine()) | ||
tftpboot.create_tftp_network() | ||
file_list.append(cdrom_path) | ||
cdrom_dict = eval(params.get("cdrom_dict") % cdrom_path) | ||
cdrom_dict.update(cdrom_order) | ||
cdrom_xml = libvirt_vmxml.create_vm_device_by_type("disk", cdrom_dict) | ||
vmxml.add_device(cdrom_xml) | ||
if memory: | ||
vmxml.memory = int(memory) | ||
vmxml.current_mem = int(memory) | ||
vmxml.sync() | ||
# Update boot order attributes | ||
if "hd" in (first_dev, second_dev): | ||
|
@@ -74,10 +87,13 @@ def run(test, params, env): | |
check_prompt = eval(params.get("check_prompt", "[]")) | ||
bootable_device = params.get("bootable_device") | ||
os_dict = eval(params.get("os_dict")) | ||
test_cmd = params.get("test_cmd", None) | ||
expected_output = params.get("expected_output", None) | ||
|
||
vm = env.get_vm(vm_name) | ||
vmxml = vm_xml.VMXML.new_from_inactive_dumpxml(vm.name) | ||
bkxml = vmxml.copy() | ||
session = None | ||
|
||
try: | ||
test.log.info("TEST_SETUP: prepare a guest with necessary attributes.") | ||
|
@@ -89,13 +105,22 @@ def run(test, params, env): | |
test.log.debug(f"The current guest xml is: {vmxml}") | ||
test.log.info("TEST_STEP2: check the guest boot from expected device.") | ||
if bootable_device == "hd_bootable": | ||
vm.wait_for_login(timeout=360).close() | ||
session = vm.wait_for_login(timeout=360) | ||
test.log.debug("Succeed to boot %s", vm_name) | ||
if test_cmd is not None: | ||
output = session.cmd(test_cmd) | ||
if not re.search(expected_output, output): | ||
test.fail(f"Couldn't get {expected_output}, got instead {output}") | ||
test.log.debug("Succeed to set %s", expected_output) | ||
session.close() | ||
else: | ||
vm.serial_console.read_until_output_matches(check_prompt, timeout=300, | ||
internal_timeout=0.5) | ||
finally: | ||
if session: | ||
session.close() | ||
bkxml.sync() | ||
tftpboot.cleanup() | ||
for file in file_list: | ||
if os.path.exists(file): | ||
os.remove(file) |
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
Oops, something went wrong.