summaryrefslogtreecommitdiffstats
path: root/virt-what.in
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2011-05-25 11:13:50 +0100
committerRichard W.M. Jones <rjones@redhat.com>2011-05-25 11:14:21 +0100
commit441ce9d9ecf9edf0f325c280451ba69dc160882e (patch)
tree1d5f9efc661c16e3eb3faf7dd6fed1e1bb3f08d6 /virt-what.in
parentf9bf43287a6278ad43f3d5a3931e57f8826692af (diff)
downloadvirt-what-441ce9d9ecf9edf0f325c280451ba69dc160882e.tar.gz
virt-what-441ce9d9ecf9edf0f325c280451ba69dc160882e.tar.xz
virt-what-441ce9d9ecf9edf0f325c280451ba69dc160882e.zip
Fix for KVM with explicit -cpu model parameter.
Diffstat (limited to 'virt-what.in')
-rw-r--r--virt-what.in26
1 files changed, 16 insertions, 10 deletions
diff --git a/virt-what.in b/virt-what.in
index e0fdf5b..a27be10 100644
--- a/virt-what.in
+++ b/virt-what.in
@@ -166,13 +166,14 @@ fi
# Check for Parallels.
if echo "$dmi" | grep -q 'Vendor: Parallels'; then
echo parallels
+ skip_qemu_kvm=1
fi
# Check for Xen.
if [ "$cpuid" = "XenVMMXenVMM" ]; then
echo xen; echo xen-hvm
- is_xen=1
+ skip_qemu_kvm=1
elif [ -f $root/proc/xen/capabilities ]; then
echo xen
if grep -q "control_d" $root/proc/xen/capabilities; then
@@ -180,7 +181,7 @@ elif [ -f $root/proc/xen/capabilities ]; then
else
echo xen-domU
fi
- is_xen=1
+ skip_qemu_kvm=1
elif [ -f $root/sys/hypervisor/type ] &&
grep -q "xen" $root/sys/hypervisor/type; then
# Ordinary kernel with pv_ops. There does not seem to be
@@ -190,15 +191,20 @@ elif [ -f $root/sys/hypervisor/type ] &&
fi
# Check for QEMU/KVM.
+#
+# Parallels exports KVMKVMKVM leaf, so skip this test if we've already
+# seen that it's Parallels. Xen uses QEMU as the device model, so
+# skip this test if we know it is Xen.
-if [ ! "$is_xen" ]; then
- # Disable this test if we know this is Xen already, because Xen
- # uses QEMU for its device model.
-
- if grep -q 'QEMU' $root/proc/cpuinfo; then
- if [ "$cpuid" = "KVMKVMKVM" ]; then
- echo kvm
- else
+if [ ! "$skip_qemu_kvm" ]; then
+ if [ "$cpuid" = "KVMKVMKVM" ]; then
+ echo kvm
+ else
+ # XXX This is known to fail for qemu with the explicit -cpu
+ # option, since /proc/cpuinfo will not contain the QEMU
+ # string. The long term fix for this would be to export
+ # another CPUID leaf for non-accelerated qemu.
+ if grep -q 'QEMU' $root/proc/cpuinfo; then
echo qemu
fi
fi