提交 4e1281bc 编写于 作者: S sebastian

Failed to get machine type in arm

cpu,qemu_vm,env_process: Judge machine type in supported machine types.
                         If not, will using default value 'virt'.

Current the param of machine type must be in format "xx:xx", otherwise
it will cause error "list index out of range".
上级 bc09fe1a
......@@ -1234,7 +1234,16 @@ def get_qemu_best_cpu_model(params):
qemu_binary = utils_misc.get_qemu_binary(params)
# aarch64 use 'qemu_binary -M machine_type -cpu ?' to get supported cpu models.
if platform.machine() == 'aarch64':
machine_type = params.get("machine_type").split(':', 1)[1]
machine_type = params.get("machine_type")
if ':' in machine_type:
machine_type = machine_type.split(':', 1)[1]
# Needed to judge if machine_type supported in arm
hvm_or_pv = params.get("hvm_or_pv", "hvm")
from virttest.utils_test import libvirt
support_machine_type = libvirt.get_machine_types('aarch64', hvm_or_pv, ignore_status=False)
if machine_type not in support_machine_type:
logging.warn("Unsupported machine type %s", machine_type)
machine_type = 'virt'
extra_params = " -M" + " %s" % machine_type
qemu_cpu_models = get_qemu_cpu_models(qemu_binary, extra_params)
else:
......
......@@ -1038,7 +1038,17 @@ def preprocess(test, params, env):
qemu_path = utils_misc.get_qemu_binary(params)
# aarch64 use "qemu-kvm -M machine_type" instead.
if platform.machine() == 'aarch64':
machine_type = params.get("machine_type").split(':', 1)[1]
machine_type = params.get("machine_type")
if ':' in machine_type:
machine_type = machine_type.split(':', 1)[1]
# Needed to judge if machine_type supported in arm
hvm_or_pv = params.get("hvm_or_pv", "hvm")
from virttest.utils_test import libvirt
support_machine_type = libvirt.get_machine_types(
'aarch64', hvm_or_pv, ignore_status=False)
if machine_type not in support_machine_type:
logging.warn("Unsupported machine type %s", machine_type)
machine_type = 'virt'
qemu_path = qemu_path + " -M" + " %s" % machine_type
if (utils_qemu.has_device_category(qemu_path, "CPU")
and params.get("cpu_driver") is None):
......
......@@ -1412,7 +1412,17 @@ class VM(virt_vm.BaseVM):
shell=True)).split(',')[0]
# aarch64 use "qemu-kvm -M machine_type -cpu ?" to get supported cpu models.
if platform.machine() == 'aarch64':
machine_type = params.get("machine_type").split(':', 1)[1]
machine_type = params.get("machine_type")
if ':' in machine_type:
machine_type = machine_type.split(':', 1)[1]
# Needed to judge if machine_type supported in arm
hvm_or_pv = params.get("hvm_or_pv", "hvm")
from virttest.utils_test import libvirt
support_machine_type = libvirt.get_machine_types(
'aarch64', hvm_or_pv, ignore_status=False)
if machine_type not in support_machine_type:
logging.warn("Unsupported machine type %s", machine_type)
machine_type = 'virt'
support_cpu_model = decode_to_text(process.system_output("%s -M %s -cpu \\? " % (qemu_binary, machine_type),
verbose=False,
ignore_status=True,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册