Bug 1133155 - virt-install --cpu host should use host-model if libvirt supports it
Summary: virt-install --cpu host should use host-model if libvirt supports it
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Virtualization Tools
Classification: Community
Component: virt-manager
Version: unspecified
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: Cole Robinson
QA Contact:
URL:
Whiteboard:
: 1145293 1243932 (view as bug list)
Depends On:
Blocks: 1188245
TreeView+ depends on / blocked
 
Reported: 2014-08-22 22:16 UTC by David Hill
Modified: 2019-07-11 08:08 UTC (History)
11 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1188245 (view as bug list)
Environment:
Last Closed: 2014-09-21 00:45:43 UTC


Attachments (Terms of Use)

Description David Hill 2014-08-22 22:16:19 UTC
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

Comment 1 David Hill 2014-08-22 22:18:55 UTC
Seems like the following patch is causing me issues:

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

Comment 2 David Hill 2014-08-22 22:34:53 UTC
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

Comment 3 David Hill 2014-08-22 22:42:11 UTC
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.

Comment 4 Ján Tomko 2014-08-25 08:37:47 UTC
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.)

Comment 5 Cole Robinson 2014-09-05 21:30:59 UTC
David, does --cpu host-model work for you?

Comment 6 Cole Robinson 2014-09-05 21:31:47 UTC
(not that I'm saying that's the permanent solution, I'm just wondering if libvirt has the same problem)

Comment 7 Ján Tomko 2014-09-08 07:35:53 UTC
Libvirt's host-model had the same problem, but it should be fixed in upstream git, see bug 1138221.

Comment 8 Cole Robinson 2014-09-08 11:15:16 UTC
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

Comment 9 Cole Robinson 2014-09-21 00:45:43 UTC
Fixed upstream now:

commit b0d5198b7abdb1ac48709b991d84ca3259ecb9aa
Author: Cole Robinson <crobinso@redhat.com>
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@redhat.com>
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

Comment 10 Cole Robinson 2014-09-22 20:38:58 UTC
*** Bug 1145293 has been marked as a duplicate of this bug. ***

Comment 11 ddu 2015-05-26 04:36:40 UTC
One cu set 'Copy host CPU congiguation' in virt-manager, then the vm cannot boot up. It seems to be the same bug. Do we have any plan to fix it in the future?

Comment 12 Cole Robinson 2015-05-26 14:37:09 UTC
(In reply to ddu from comment #11)
> One cu set 'Copy host CPU congiguation' in virt-manager, then the vm cannot
> boot up. It seems to be the same bug. Do we have any plan to fix it in the
> future?

You need to file a separate bug report and give complete details about your virt-install version and host OS, and the error message

Comment 13 ddu 2015-05-28 05:21:05 UTC
Cu didn't use virt-install, but after the vm is installed, he just set 'Copy host CPU configuration' to copy host cpu configuration to vm, which cause 'invtsc' to be copied to vm setting, then vm cannot boot up. After comment out 'invtsc' line
in the setting file, vm can boot up normally. So I think this is the same bug.

Comment 14 Pavel Hrdina 2015-09-04 08:25:16 UTC
*** Bug 1243932 has been marked as a duplicate of this bug. ***


Note You need to log in before you can comment on or make changes to this bug.