From: Jiri Denemark Date: Wed, 13 Apr 2016 07:06:23 +0000 (+0200) Subject: capabilities: Advertise cpuselection if -cpu host is usable X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=ced1e846a03bf56fb45bb3ef67da97f6ba1fc5c5;p=libvirt.git capabilities: Advertise cpuselection if -cpu host is usable When -cpu host is supported by a QEMU binary, a user can use in domain XML even when libvirtd failed to find a matching model for the host CPU. Let's make it obvious by advertising guest capability whenever -cpu host is supported. Signed-off-by: Jiri Denemark --- diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 1bddf439cb..fcfd1cdaa3 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -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; diff --git a/tests/qemucaps2xmldata/all_1.6.0-1.xml b/tests/qemucaps2xmldata/all_1.6.0-1.xml index 2489f49b4f..84d60008d8 100644 --- a/tests/qemucaps2xmldata/all_1.6.0-1.xml +++ b/tests/qemucaps2xmldata/all_1.6.0-1.xml @@ -18,6 +18,7 @@ + diff --git a/tests/qemucaps2xmldata/nodisksnapshot_1.6.0-1.xml b/tests/qemucaps2xmldata/nodisksnapshot_1.6.0-1.xml index 281fab0756..28762c263b 100644 --- a/tests/qemucaps2xmldata/nodisksnapshot_1.6.0-1.xml +++ b/tests/qemucaps2xmldata/nodisksnapshot_1.6.0-1.xml @@ -18,6 +18,7 @@ +