]> xenbits.xensource.com Git - libvirt.git/commitdiff
capabilities: Advertise cpuselection if -cpu host is usable
authorJiri Denemark <jdenemar@redhat.com>
Wed, 13 Apr 2016 07:06:23 +0000 (09:06 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Mon, 16 May 2016 08:42:28 +0000 (10:42 +0200)
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: Jiri Denemark <jdenemar@redhat.com>
src/qemu/qemu_capabilities.c
tests/qemucaps2xmldata/all_1.6.0-1.xml
tests/qemucaps2xmldata/nodisksnapshot_1.6.0-1.xml

index 1bddf439cbb7b626ec5874c15f8a0c75b9409454..fcfd1cdaa3aed3cc44ca9506374a7e91f9f925f2 100644 (file)
@@ -928,9 +928,10 @@ virQEMUCapsInitGuestFromBinary(virCapsPtr caps,
     machines = NULL;
     nmachines = 0;
 
-    if (caps->host.cpu &&
-        caps->host.cpu->model &&
-        virQEMUCapsGetCPUDefinitions(qemubinCaps, NULL) > 0 &&
+    if ((virQEMUCapsGet(qemubinCaps, QEMU_CAPS_CPU_HOST) ||
+         (caps->host.cpu &&
+          caps->host.cpu->model &&
+          virQEMUCapsGetCPUDefinitions(qemubinCaps, NULL) > 0)) &&
         !virCapabilitiesAddGuestFeature(guest, "cpuselection", true, false))
         goto cleanup;
 
index 2489f49b4f79ccdc9beb20963308230395e2bab8..84d60008d826a5b1f40afe0714a21eac048b543d 100644 (file)
@@ -18,6 +18,7 @@
       </domain>
     </arch>
     <features>
+      <cpuselection/>
       <deviceboot/>
       <disksnapshot default='on' toggle='no'/>
       <acpi default='on' toggle='yes'/>
index 281fab0756e64309bf13946e1258359bd81b7b94..28762c263bbf4cad2d70eb2afc6f5a7e65008f40 100644 (file)
@@ -18,6 +18,7 @@
       </domain>
     </arch>
     <features>
+      <cpuselection/>
       <deviceboot/>
       <disksnapshot default='off' toggle='no'/>
       <acpi default='on' toggle='yes'/>