Bug 1805755

Summary: Setting a CPU (or having the default one being set) for MIPS machine using qemu prevents launching them
Product: [Community] Virtualization Tools Reporter: Jean-Pierre Flori <jpflori>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: jdenemar, jpflori, libvirt-maint, tburke
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-6.1.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-02-26 11:22:59 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jean-Pierre Flori 2020-02-21 13:45:34 UTC
Description of problem:
The qemuDomainDefSetDefaultCPU call in qemuDomainDefPostParse uses qemu 4.2 default CPU model and enforce it.
But it then triggers a check because vm->def->cpu is set in virCPUValidateFeatures in qemu_process.c which calls cpuGetSubDriver which fails as there are only drivers for x86, ppc, s390 and arm as far as I can see in cpu.c.

Setting explicitely a CPU also makes the VM start fail (As it takes the same check code path).

A workaround is sticking with older qemu < 4.2.0

How reproducible:
Always

Steps to Reproduce:
1. define a mipsel vm using virsh
2. try to start it

Actual results:
t fails with this function is not supported by the connection driver: 'mipsel' architecture is not supported by CPU driver

Expected results:
The VM starts

Comment 1 Jiri Denemark 2020-02-25 15:49:01 UTC
I've just sent a patch which should fix this issue:
https://www.redhat.com/archives/libvir-list/2020-February/msg01014.html

Feel free to give it a try and report the results.

Comment 2 Jiri Denemark 2020-02-26 11:22:59 UTC
This is fixed in libvirt.git by the following commit which will be included in libvirt 6.1.0 release:

commit 768ecdcd4b189cfe1d86a50bc1730f3948379f6f
Refs: v6.0.0-531-g768ecdcd4b
Author:     Jiri Denemark <jdenemar>
AuthorDate: Tue Feb 25 16:05:06 2020 +0100
Commit:     Jiri Denemark <jdenemar>
CommitDate: Wed Feb 26 12:16:32 2020 +0100

    qemu: Do not set default CPU for archs without CPU driver

    Whenever there is a guest CPU configured in domain XML, we will call
    some CPU driver APIs to validate the CPU definition and check its
    compatibility with the hypervisor. Thus domains with guest CPU
    specification can only be started if the guest architecture is supported
    by the CPU driver. But we would add a default CPU to any domain as long
    as QEMU reports it causing failures to start any domain on affected
    architectures.

    https://bugzilla.redhat.com/show_bug.cgi?id=1805755

    Signed-off-by: Jiri Denemark <jdenemar>
    Reviewed-by: Daniel P. Berrangé <berrange>