-
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.
Merge pull request #4924 from meinaLi/smm
guest_os_booting: add new case for ovmf smm
- Loading branch information
Showing
2 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
libvirt/tests/cfg/guest_os_booting/ovmf_firmware/ovmf_smm.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
- guest_os_booting.ovmf_smm: | ||
type = ovmf_smm | ||
start_vm = no | ||
smm_state = "on" | ||
firmware_type = "ovmf" | ||
only q35 | ||
variants: | ||
- positive_test: | ||
variants: | ||
- tseg_48M: | ||
smm_tseg_size = "48" | ||
smm_xpath = [{'element_attrs':[".//tseg[@unit='MiB']"], 'text':'${smm_tseg_size}'}] | ||
- tseg_0M: | ||
smm_tseg_size = "0" | ||
smm_xpath = [{'element_attrs':[".//tseg[@unit='B']"], 'text':'${smm_tseg_size}'}] | ||
- smm_off: | ||
smm_state = "off" | ||
loader_path = "/usr/share/edk2/ovmf/OVMF_CODE.fd" | ||
nvram_path = "/var/lib/libvirt/qemu/nvram/nvram_VARS.fd" | ||
nvram_template = "/usr/share/edk2/ovmf/OVMF_VARS.fd" | ||
loader_dict = {'loader': '${loader_path}', 'nvram': '${nvram_path}', 'nvram_attrs': {'template': '${nvram_template}'}, 'loader_readonly': 'yes', 'loader_type': 'pflash', 'secure': 'no'} | ||
smm_xpath = [{'element_attrs':[".//smm[@state='${smm_state}']"]}] | ||
- negative_test: | ||
variants: | ||
- tseg_12345M: | ||
smm_tseg_size = "12345" | ||
error_msg = "qemu-kvm: invalid extended-tseg-mbytes value: 12345" | ||
- tseg_-2M: | ||
smm_tseg_size = "-2" | ||
error_msg = "Invalid value '-2' for element or attribute" |
49 changes: 49 additions & 0 deletions
49
libvirt/tests/src/guest_os_booting/ovmf_firmware/ovmf_smm.py
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,49 @@ | ||
# | ||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
# | ||
# Copyright Red Hat | ||
# | ||
# SPDX-License-Identifier: GPL-2.0 | ||
|
||
# Author: Meina Li <[email protected]> | ||
# | ||
from virttest.libvirt_xml import vm_xml | ||
from virttest.libvirt_xml import xcepts | ||
from virttest.utils_libvirt import libvirt_vmxml | ||
|
||
from provider.guest_os_booting import guest_os_booting_base as guest_os | ||
|
||
|
||
def run(test, params, env): | ||
""" | ||
This case is to verify the ovmf smm elements. | ||
1) Prepare a guest with related smm elements. | ||
2) Start and boot the guest. | ||
""" | ||
vm_name = params.get("main_vm") | ||
smm_state = params.get("smm_state") | ||
smm_tseg_size = params.get("smm_tseg_size", "") | ||
smm_xpath = eval(params.get("smm_xpath", "{}")) | ||
error_msg = params.get("error_msg") | ||
firmware_type = params.get("firmware_type") | ||
loader_dict = eval(params.get("loader_dict", "{}")) | ||
|
||
vm = env.get_vm(vm_name) | ||
vmxml = vm_xml.VMXML.new_from_inactive_dumpxml(vm_name) | ||
bkxml = vmxml.copy() | ||
|
||
try: | ||
try: | ||
guest_os.prepare_smm_xml(vm_name, smm_state, smm_tseg_size) | ||
except xcepts.LibvirtXMLError as details: | ||
if error_msg and error_msg in str(details): | ||
test.log.info("Get expected error message: %s.", error_msg) | ||
return | ||
else: | ||
test.fail("Failed to define the guest because error:%s", str(details)) | ||
if smm_state == "off": | ||
guest_os.prepare_os_xml(vm_name, loader_dict, firmware_type) | ||
vmxml = guest_os.check_vm_startup(vm, vm_name, error_msg) | ||
libvirt_vmxml.check_guest_xml_by_xpaths(vmxml, smm_xpath) | ||
finally: | ||
bkxml.sync() |