提交 c6ff3d15 编写于 作者: J Jiri Denemark

qemu_capabilities: Disable CPU models on old s390 machine types

Starting a KVM domain on s390 with old machine type (such as
s390-ccw-virtio-2.5) and without any guest CPU model configured fails
with

    CPU models are not available: KVM doesn't support CPU models

QEMU error. This is cause by libvirt using host-model CPU as the default
CPU based on QEMU reporting "host" CPU model as being the default one
(see commit v5.9.0-402-g24d82022: qemu: Use host-model CPU on s390 by
default). However, even though both QEMU and KVM support CPU models on
s390 and QEMU can give us the host-model CPU, we can't use it with old
machine types which only support -cpu host.

https://bugzilla.redhat.com/show_bug.cgi?id=1795651Reported-by: NChristian Ehrhardt <paelzer@gmail.com>
Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 8c3aed23
...@@ -2274,16 +2274,33 @@ virQEMUCapsIsVirtTypeSupported(virQEMUCapsPtr qemuCaps, ...@@ -2274,16 +2274,33 @@ virQEMUCapsIsVirtTypeSupported(virQEMUCapsPtr qemuCaps,
return false; return false;
} }
const char *s390HostPassthroughOnlyMachines[] = {
"s390-ccw-virtio-2.4",
"s390-ccw-virtio-2.5",
"s390-ccw-virtio-2.6",
"s390-ccw-virtio-2.7",
NULL
};
bool bool
virQEMUCapsIsCPUModeSupported(virQEMUCapsPtr qemuCaps, virQEMUCapsIsCPUModeSupported(virQEMUCapsPtr qemuCaps,
virArch hostarch, virArch hostarch,
virDomainVirtType type, virDomainVirtType type,
virCPUMode mode, virCPUMode mode,
const char *machineType G_GNUC_UNUSED) const char *machineType)
{ {
qemuMonitorCPUDefsPtr cpus; qemuMonitorCPUDefsPtr cpus;
/* CPU models (except for "host") are not supported by QEMU for on s390
* KVM domains with old machine types regardless on QEMU version. */
if (ARCH_IS_S390(qemuCaps->arch) &&
type == VIR_DOMAIN_VIRT_KVM &&
mode != VIR_CPU_MODE_HOST_PASSTHROUGH &&
machineType &&
g_strv_contains(s390HostPassthroughOnlyMachines, machineType)) {
return false;
}
switch (mode) { switch (mode) {
case VIR_CPU_MODE_HOST_PASSTHROUGH: case VIR_CPU_MODE_HOST_PASSTHROUGH:
return type == VIR_DOMAIN_VIRT_KVM && return type == VIR_DOMAIN_VIRT_KVM &&
......
...@@ -13,9 +13,7 @@ QEMU_AUDIO_DRV=none \ ...@@ -13,9 +13,7 @@ QEMU_AUDIO_DRV=none \
-object secret,id=masterKey0,format=raw,\ -object secret,id=masterKey0,format=raw,\
file=/tmp/lib/domain--1-test/master-key.aes \ file=/tmp/lib/domain--1-test/master-key.aes \
-machine s390-ccw-virtio-2.7,accel=kvm,usb=off,dump-guest-core=off \ -machine s390-ccw-virtio-2.7,accel=kvm,usb=off,dump-guest-core=off \
-cpu z13.2-base,aen=on,aefsi=on,msa5=on,msa4=on,msa3=on,msa2=on,msa1=on,\ -cpu host \
sthyi=on,edat=on,ri=on,edat2=on,vx=on,ipter=on,ap=on,esop=on,apft=on,apqci=on,\
cte=on,bpb=on,ppa15=on,zpci=on,sea_esop2=on,te=on,cmm=on \
-m 256 \ -m 256 \
-overcommit mem-lock=off \ -overcommit mem-lock=off \
-smp 1,sockets=1,cores=1,threads=1 \ -smp 1,sockets=1,cores=1,threads=1 \
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<type arch='s390x' machine='s390-ccw-virtio-2.7'>hvm</type> <type arch='s390x' machine='s390-ccw-virtio-2.7'>hvm</type>
<boot dev='hd'/> <boot dev='hd'/>
</os> </os>
<cpu mode='host-model' check='partial'/> <cpu mode='host-passthrough' check='none'/>
<clock offset='utc'/> <clock offset='utc'/>
<on_poweroff>destroy</on_poweroff> <on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot> <on_reboot>restart</on_reboot>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册