Bug 1160318

Summary: internal error: Cannot find suitable CPU model for given data
Product: [Fedora] Fedora Reporter: Matías Kreder <mkreder>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 21CC: agedosier, berrange, clalancette, crobinso, ehabkost, itamar, jdenemar, jforbes, jreznik, laine, libvirt-maint, veillard, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-1.2.9.1-1.fc21 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1252363 (view as bug list) Environment:
Last Closed: 2014-11-18 12:20:31 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:
Attachments:
Description Flags
libvirtd log with intel-vt disabled
none
capabilities xml none

Description Matías Kreder 2014-11-04 14:41:46 UTC
Description of problem:

After installing Fedora 21 Workstation Alpha on Lenovo Thinkpad T410. virt-manager is not able to create any VM. 

Version-Release number of selected component (if applicable):
qemu-kvm-2.1.2-6.fc21.x86_64
libvirt-daemon-1.2.9-4.fc21.x86_64
virt-manager-1.1.0-3.git310f6527.fc21.noarch

How reproducible:
Always

Steps to Reproduce:
1. Install Fedora 21 Alpha on T410
2. Try to create VM on virt-manager
3. Get to the end of the wizard

Actual results:
It fails with error "internal error: Cannot find suitable CPU model for given data"

Expected results:
It should create the VM.

Additional info:
Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 89, in cb_wrapper
    callback(asyncjob, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/create.py", line 1854, in do_install
    guest.start_install(meter=meter)
  File "/usr/share/virt-manager/virtinst/guest.py", line 411, in start_install
    noboot)
  File "/usr/share/virt-manager/virtinst/guest.py", line 475, in _create_guest
    dom = self.conn.createLinux(start_xml or final_xml, 0)
  File "/usr/lib64/python2.7/site-packages/libvirt.py", line 3361, in
createLinux
    if ret is None:raise libvirtError('virDomainCreateLinux() failed',
conn=self)
libvirtError: internal error: Cannot find suitable CPU model for given data

On "systemctl status libvirtd" I can see:

Nov 04 10:23:41 lappie.mkeder.com libvirtd[3822]: Preferred CPU model
Westmere not allowed by hypervisor; closest supported model will be
used
Nov 04 10:23:41 lappie.mkeder.com libvirtd[3822]: internal error:
Cannot find suitable CPU model for given data

I haven't tried Fedora 20 on it but I might re-install it soon. Just
wanted to give my feedback for Fedora 21.
Doing a google search it seems that some people had the same problem a
few months ago and they solved but by updating. Seems to be some sort
of problem between libvirt and qemu-kvm. Like this:

https://www.redhat.com/archives/libvir-list/2014-March/msg00609.html


Logs are on fpaste:

virsh capabilities -> http://paste.fedoraproject.org/147736/15110815/
libvirtd debug -> http://fpaste.org/147741/51114361/

Comment 1 Matías Kreder 2014-11-04 14:46:49 UTC
This was fixed by stopping libvirt, removing all files on /var/cache/libvirt/qemu/capabilities/ and starting it again.

After the installation on Fedora 21 Alpha, when trying to create the VM the first time the BIOS setting for Intel Virtualization was disabled. After I enabled it I was getting the error reported on this bug. It was fixed by removing the cached files. 

It will be good if the cache files are cleaned up on this error or something so this doesn't happen to an average user.

Comment 2 Matías Kreder 2014-11-04 15:00:30 UTC
Created attachment 953648 [details]
libvirtd log with intel-vt disabled

libvirtd log with intel-vt disabled

Comment 3 Matías Kreder 2014-11-04 15:10:12 UTC
Created attachment 953657 [details]
capabilities xml

Comment 4 Jiri Denemark 2014-11-12 16:08:40 UTC
So the problem is in the /usr/bin/qemu-kvm wrapper, which runs qemu-system-x86_64 with -machine accel=kvm to force KVM. When libvirt starts, it probes QEMU binaries by running them with "-S -no-user-config -nodefaults -nographic -M none -qmp ... -pidfile ... -daemonize" to get a dummy process with QMP monitor which we can ask for available QMP commands, machine types, and lots of other things. Howver, when qemu-kvm wrapper forces the dummy process to enable KVM, it fails to start if KVM cannot be enabled for some reason (missing module, disabled by BIOS, ...). If that happens, we fall back to the old way of parsing -help, -cpu ?, etc. output. And since we implemented QMP probing for QEMU 1.2.0, we don't keep up with any changes made in "-cpu ?" output and thus fail to parse it properly. But we shouldn't even try to use the old way of probing QEMU capabilities because we know it's not going to work...

Comment 5 Jiri Denemark 2014-11-12 16:10:03 UTC
Patch sent upstream for review: https://www.redhat.com/archives/libvir-list/2014-November/msg00407.html

Comment 6 Cole Robinson 2014-11-12 16:15:25 UTC
Another option could be to alter the qemu-kvm wrapper script and change it to not use accel=kvm if -nodefaults is passed, that way we don't need to work around it in libvirt

Comment 7 Cole Robinson 2014-11-12 16:16:28 UTC
(Although that patch looks useful anyways)

Comment 8 Eduardo Habkost 2014-11-12 16:24:14 UTC
Can't the qemu-kvm wrapper simply use accel=kvm:tcg, and fallback to TCG if KVM is not available? (Wasn't it the behavior of qemu-kvm in the past, before the upstream merge?)

Comment 9 Jiri Denemark 2014-11-13 23:23:52 UTC
Pushed upstream as v1.2.10-104-gae3e29e6:

commit ae3e29e6e7a9a208732f22721e735d238b2aa8cb
Author: Jiri Denemark <jdenemar>
Date:   Wed Nov 12 16:49:59 2014 +0100

    qemu: Don't try to parse -help for new QEMU
    
    Since QEMU 1.2.0, we switched to QMP probing instead of parsing -help
    (and other commands, such as -cpu ?) output. However, if QMP probing
    failed, we still tried starting QEMU with various options and parsing
    the output, which was guaranteed to fail because the output changed.
    Let's just refuse parsing -help for QEMU >= 1.2.0.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1160318
    Signed-off-by: Jiri Denemark <jdenemar>

Comment 10 Fedora Update System 2014-11-16 01:23:23 UTC
libvirt-1.2.9.1-1.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/libvirt-1.2.9.1-1.fc21

Comment 11 Fedora Update System 2014-11-16 14:41:50 UTC
Package libvirt-1.2.9.1-1.fc21:
* should fix your issue,
* was pushed to the Fedora 21 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing libvirt-1.2.9.1-1.fc21'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-15167/libvirt-1.2.9.1-1.fc21
then log in and leave karma (feedback).

Comment 12 Fedora Update System 2014-11-18 12:20:31 UTC
libvirt-1.2.9.1-1.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.