提交 051184ed 编写于 作者: L Lukáš Doktor

qemu..smbios: Modify to work well on upstream qemu as well

The upstream qemu sets different System.Version than RHEL qemu.
Signed-off-by: NLukáš Doktor <ldoktor@redhat.com>
上级 e0778947
......@@ -18,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
......@@ -65,6 +66,11 @@ 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
......@@ -91,13 +97,22 @@ def run(test, params, env):
cmd = (dmidecode_exp % (smbios_type_number, key))
smbios_get_para = session.cmd(cmd).strip()
default_key_para = decode_to_text(process.system_output(
cmd, shell=True).strip())
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.
先完成此消息的编辑!
想要评论请 注册