Bug 1188245

Summary: virt-install --cpu host should use host-model if libvirt supports it
Product: Red Hat Enterprise Linux 6 Reporter: Pratik Pravin Bandarkar <pbandark>
Component: virt-managerAssignee: virt-mgr-maint
Status: CLOSED DUPLICATE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.6CC: asegundo, berrange, crobinso, dhill, dyuan, gscrivan, jtomko, mzhan, noel, rbalakri, rharwood, tzheng
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1133155 Environment:
Last Closed: 2015-02-02 16:11:54 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:
Bug Depends On: 1133155    
Bug Blocks:    

Description Pratik Pravin Bandarkar 2015-02-02 12:11:31 UTC
+++ This bug was initially created as a clone of Bug #1133155 +++

Description of problem:
libvirt-1.2.7 was compiled and installed.
qemu-2.1.0 was compiled and installed.
When we're trying to start a VM using virt-install, libvirt throws back the following error message:
Fri, 22 Aug 2014 22:14:23 DEBUG    Removing /var/lib/libvirt/boot/virtinst-vmlinuz.TJ4UiJ
Fri, 22 Aug 2014 22:14:23 DEBUG    Removing /var/lib/libvirt/boot/virtinst-initrd.img.oM_Gbt
Fri, 22 Aug 2014 22:14:23 ERROR    unsupported configuration: host doesn't support invariant TSC
Fri, 22 Aug 2014 22:14:23 DEBUG    Traceback (most recent call last):
  File "/usr/sbin/virt-install", line 629, in start_install
    noboot=options.noreboot)
  File "/usr/lib/python2.6/site-packages/virtinst/Guest.py", line 1223, in start_install
    noboot)
  File "/usr/lib/python2.6/site-packages/virtinst/Guest.py", line 1291, in _create_guest
    dom = self.conn.createLinux(start_xml or final_xml, 0)
  File "/usr/lib64/python2.6/site-packages/libvirt.py", line 3320, in createLinux
    if ret is None:raise libvirtError('virDomainCreateLinux() failed', conn=self)
libvirtError: unsupported configuration: host doesn't support invariant TSC
Fri, 22 Aug 2014 22:14:23 DEBUG    Domain installation does not appear to have been successful.

Version-Release number of selected component (if applicable):
qemu-2.1.0
libvirt-1.2.7

How reproducible:
Always

Steps to Reproduce:
1. Install libvirt-1.2.7
2. Install qemu-2.10
3. Try to run virt-install
virt-install -d --connect qemu:///system --name centos-7-x86_64 --ram 4096 --vcpus 2 --vnc --vnclisten 0.0.0.0 --os-type=linux --os-variant=rhel6 --location http://centos.mirror.iweb.ca/7/os/x86_64/ --initrd-inject=centos7.ks --extra-args="ks=file:/centos7.ks ip=dhcp" --disk=${installpath}${tmp}/centos-7-x86_64.qcow2,size=20,bus=virtio,format=qcow2 --force --network=bridge:br100,model=virtio,mac=${mac} --noautoconsole --accelerate --noapic --keymap=en-us -v --cpu host


Actual results:
See above

Expected results:
Should launch the installation

Additional info:
email be if you need more info

--- Additional comment from David Hill on 2014-08-22 18:18:55 EDT ---

Seems like the following patch is causing me issues:

https://gitorious.org/libvirt/libvirt/commit/fba6bc47cbcabbe08d42279691efb0dff3b9c997

--- Additional comment from David Hill on 2014-08-22 18:34:53 EDT ---

Those are the flags my CPUs have:
lags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 sse4_2 popcnt lahf_lm ida dtherm tpr_shadow vnmi flexpriority ept vpid
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 sse4_2 popcnt lahf_lm ida dtherm tpr_shadow vnmi flexpriority ept vpid
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 sse4_2 popcnt lahf_lm ida dtherm tpr_shadow vnmi flexpriority ept vpid
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 sse4_2 popcnt lahf_lm ida dtherm tpr_shadow vnmi flexpriority ept vpid
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 sse4_2 popcnt lahf_lm ida dtherm tpr_shadow vnmi flexpriority ept vpid
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 sse4_2 popcnt lahf_lm ida dtherm tpr_shadow vnmi flexpriority ept vpid
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 sse4_2 popcnt lahf_lm ida dtherm tpr_shadow vnmi flexpriority ept vpid
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 sse4_2 popcnt lahf_lm ida dtherm tpr_shadow vnmi flexpriority ept vpid

--- Additional comment from David Hill on 2014-08-22 18:42:11 EDT ---

Ok, I managed to get it going by a adding this : --cpu Nehalem,-invtsc to the command line instead of --cpu host,-invtsc.


This part on the QEMU wiki (http://wiki.qemu.org/ChangeLog/2.1) got me consued...
KVM
New "invtsc" (Invariant TSC) CPU feature. When enabled, this will block migration and savevm, so it is not enabled by default on any CPU model. To enable invtsc, the migratable=no flag (supported only by -cpu host, by now) is required. So, invtsc is available only if using: -cpu host,migratable=no,+invtsc.


It says it is not enabled by default but it is actually ... for some reasons.

--- Additional comment from Jan Tomko on 2014-08-25 04:37:47 EDT ---

It is not enabled by default in QEMU or libvirt, the problem is that
virt-install with --cpu host tries to copy all the features that are present on the host CPU, adding:
    <feature policy='require' name='invtsc'/>
to the domain XML, even if the feature is not supported by KVM or QEMU.

(And if it is supported, the domain with the feature will be unable to migrate.)

--- Additional comment from Cole Robinson on 2014-09-05 17:30:59 EDT ---

David, does --cpu host-model work for you?

--- Additional comment from Cole Robinson on 2014-09-05 17:31:47 EDT ---

(not that I'm saying that's the permanent solution, I'm just wondering if libvirt has the same problem)

--- Additional comment from Jan Tomko on 2014-09-08 03:35:53 EDT ---

Libvirt's host-model had the same problem, but it should be fixed in upstream git, see bug 1138221.

--- Additional comment from Cole Robinson on 2014-09-08 07:15:16 EDT ---

Okay since host-model will protect us from this stuff, we should use it for --cpu host if libvirt is new enough (virt-install's --cpu host functionality predates host-model).

Also need to check that virt-manager isn't using the custom 'copy' behavior either

--- Additional comment from Cole Robinson on 2014-09-20 20:45:43 EDT ---

Fixed upstream now:

commit b0d5198b7abdb1ac48709b991d84ca3259ecb9aa
Author: Cole Robinson <crobinso>
Date:   Sat Sep 20 20:40:05 2014 -0400

    virt-manager: Switch 'Copy host' to use host-model (bz 1133155)
    
    Similar to the previous change for virt-install

commit eda5eea549dabb7d8dcaf5573d5f0cc0c3854e5e
Author: Cole Robinson <crobinso>
Date:   Sat Sep 20 20:40:14 2014 -0400

    virt-install: Switch --cpu host to use host-model, not copy (bz 1133155)
    
    host-model offers us other protections now, like ensuring we don't try
    to use a host cpu feature that qemu doesn't support.
    
    http://bugzilla.redhat.com/show_bug.cgi?id=1133155

--- Additional comment from Cole Robinson on 2014-09-22 16:38:58 EDT ---

Comment 2 Giuseppe Scrivano 2015-02-02 16:11:54 UTC

*** This bug has been marked as a duplicate of bug 1167072 ***