[libvirt] [PATCH] qemu: Starting a domain with custom model and allowed-fallback failed when host lacks some CPU features

Yi Wang posted 1 patch 6 years, 9 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/1496766181-38352-1-git-send-email-wang.yi59@zte.com.cn
src/qemu/qemu_process.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[libvirt] [PATCH] qemu: Starting a domain with custom model and allowed-fallback failed when host lacks some CPU features
Posted by Yi Wang 6 years, 9 months ago
An attemp to start a domain requesting a custom CPU model, core2duo, for
example, will fail if some feature that the model needs doesn't exist in that
host, even though fallback attibute is set allow:
"error: the CPU is incompatible with host CPU: Host CPU does not provide
required features: monitor"
Of course we can start that domain through forbidding that feature, but
that may not be flexible.

Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
---
 src/qemu/qemu_process.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 32ba8e3..1bb65d3 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -5324,7 +5324,8 @@ qemuProcessUpdateGuestCPU(virDomainDefPtr def,
         virCPUCompare(caps->host.arch,
                       virQEMUCapsGetHostModel(qemuCaps, def->virtType,
                                               VIR_QEMU_CAPS_HOST_CPU_FULL),
-                      def->cpu, true) < 0)
+                      def->cpu,
+                      def->cpu->fallback != VIR_CPU_FALLBACK_ALLOW) < 0)
         return -1;
 
     if (virCPUUpdate(def->os.arch, def->cpu,
-- 
1.8.3.1


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: Starting a domain with custom model and allowed-fallback failed when host lacks some CPU features
Posted by Jiri Denemark 6 years, 9 months ago
On Tue, Jun 06, 2017 at 12:23:01 -0400, Yi Wang wrote:
> An attemp to start a domain requesting a custom CPU model, core2duo, for
> example, will fail if some feature that the model needs doesn't exist in that
> host, even though fallback attibute is set allow:
> "error: the CPU is incompatible with host CPU: Host CPU does not provide
> required features: monitor"
> Of course we can start that domain through forbidding that feature, but
> that may not be flexible.

NACK, it works exactly as designed. The fallback attribute would make a
difference only if core2duo CPU model was not supported by QEMU, then
libvirt would translate it into a different supported one.

Jirka

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list