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

capabilities: Advertise cpuselection if -cpu host is usable

When -cpu host is supported by a QEMU binary, a user can use
<cpu mode='host-passthrough'/> in domain XML even when libvirtd failed
to find a matching model for the host CPU. Let's make it obvious by
advertising <cpuselection/> guest capability whenever -cpu host is
supported.
Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
上级 15225031
...@@ -928,9 +928,10 @@ virQEMUCapsInitGuestFromBinary(virCapsPtr caps, ...@@ -928,9 +928,10 @@ virQEMUCapsInitGuestFromBinary(virCapsPtr caps,
machines = NULL; machines = NULL;
nmachines = 0; nmachines = 0;
if (caps->host.cpu && if ((virQEMUCapsGet(qemubinCaps, QEMU_CAPS_CPU_HOST) ||
caps->host.cpu->model && (caps->host.cpu &&
virQEMUCapsGetCPUDefinitions(qemubinCaps, NULL) > 0 && caps->host.cpu->model &&
virQEMUCapsGetCPUDefinitions(qemubinCaps, NULL) > 0)) &&
!virCapabilitiesAddGuestFeature(guest, "cpuselection", true, false)) !virCapabilitiesAddGuestFeature(guest, "cpuselection", true, false))
goto cleanup; goto cleanup;
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
</domain> </domain>
</arch> </arch>
<features> <features>
<cpuselection/>
<deviceboot/> <deviceboot/>
<disksnapshot default='on' toggle='no'/> <disksnapshot default='on' toggle='no'/>
<acpi default='on' toggle='yes'/> <acpi default='on' toggle='yes'/>
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
</domain> </domain>
</arch> </arch>
<features> <features>
<cpuselection/>
<deviceboot/> <deviceboot/>
<disksnapshot default='off' toggle='no'/> <disksnapshot default='off' toggle='no'/>
<acpi default='on' toggle='yes'/> <acpi default='on' toggle='yes'/>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册