未验证 提交 a934ff9b 编写于 作者: Q Qianqian Zhu 提交者: GitHub

Merge pull request #1578 from ldoktor/smbios

qemu..smbios: q35 and py3 fixes
......@@ -5,6 +5,10 @@
type = smbios_table
requires_root = yes
start_vm = no
# Remove extra pci_controllers as they only make sense for q35 but we
# might be booting i440fx machines as well which would require PCIE
# bridge
pcie_extra_root_port = 0
SKU_System = "KVM"
Family_System = "VIRT"
dmikeyword_Bios = Vendor Version Date
......@@ -14,6 +18,9 @@
# Different systems may have different outputs for the item that is not set
# Please update these parameters based on your guest os system
notset_output = "Not Specified"
# RHEL uses different entries
Host_RHEL:
smbios_system_version = rhel
variants:
- type0:
smbios_type = Bios
......
import logging
import re
from avocado.utils import process
from virttest import error_context
from virttest import env_process
from virttest import utils_misc
from virttest.compat_52lts import decode_to_text
@error_context.context_aware
......@@ -39,8 +41,8 @@ def run(test, params, env):
dmidecode_key = dmidecode_key.split()
for key in dmidecode_key:
cmd = (dmidecode_exp % (smbios_type_number, key))
default_key_para = process.system_output(
cmd, shell=True).strip()
default_key_para = decode_to_text(process.system_output(
cmd, shell=True).strip())
smbios_key_para_set = params.object_params(sm_type).get(key,
default_key_para)
smbios += ",%s='%s'" % (key.lower(), smbios_key_para_set)
......@@ -64,7 +66,14 @@ def run(test, params, env):
for m_type in support_machine_types]
failures = []
rhel_system_version = params.get('smbios_system_version') == 'rhel'
if not rhel_system_version:
re_pc_lt_2 = re.compile(r'^pc-(i440fx-)?[01].\d+$')
host_dmidecode_system_version = decode_to_text(
process.system_output("dmidecode -s system-version"))
for m_type in support_machine_types:
if m_type in ("isapc", "xenfv", "xenpv"):
continue
params["machine_type"] = m_type
params["start_vm"] = "yes"
......@@ -87,14 +96,23 @@ def run(test, params, env):
for key in dmidecode_key:
cmd = (dmidecode_exp % (smbios_type_number, key))
smbios_get_para = session.cmd(cmd).strip()
default_key_para = process.system_output(
cmd, shell=True).strip()
default_key_para = decode_to_text(process.system_output(
cmd, shell=True).strip())
if params.get("smbios_type_disable", "no") == "no":
smbios_set_para = params.object_params(sm_type).get(key,
default_key_para)
else:
key_index = support_machine_types.index(m_type)
smbios_set_para = expect_system_versions[key_index]
# The System.Version is different on RHEL and upstream
if (rhel_system_version or sm_type != 'System' or
key != 'Version'):
key_index = support_machine_types.index(m_type)
smbios_set_para = expect_system_versions[key_index]
elif re_pc_lt_2.match(m_type):
# pc<2.0 inherits host system-version
smbios_set_para = host_dmidecode_system_version
else:
# Newer use machine-type
smbios_set_para = m_type
if smbios_get_para == notset_output:
smbios_get_para = default_key_para
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册