X-Git-Url: http://git.annexia.org/?p=virt-what.git;a=blobdiff_plain;f=virt-what.in;fp=virt-what.sh;h=cc61aaee4a586f19a7a2c1193ccad34ac443736e;hp=ae78f7bfe1f29626393f20845747bafe596ce175;hb=b8957a6bd16be4c6c2c2893d621ed84bf21d0f72;hpb=7880dab8d6e6d85cb086960750916b7f578e537f diff --git a/virt-what.sh b/virt-what.in similarity index 88% rename from virt-what.sh rename to virt-what.in index ae78f7b..cc61aae 100644 --- a/virt-what.sh +++ b/virt-what.in @@ -1,6 +1,6 @@ #!/bin/bash - -# -# Copyright (C) 2008 Red Hat Inc. +# @configure_input@ +# Copyright (C) 2008-2009 Red Hat Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -87,9 +87,17 @@ if [ -d /proc/vz -a ! -d /proc/bc ]; then echo openvz fi +# To tell if it is Xen and KVM HVM (fully virtualized) we can use this +# helper C program. + +cpuid=`virt-what-cpuid-helper` + # Check for Xen. -if [ -f /proc/xen/privcmd ]; then +if [ "$cpuid" = "XenVMMXenVMM" ]; then + echo xen; echo xen-hvm + is_xen=1 +elif [ -f /proc/xen/privcmd ]; then echo xen; echo xen-dom0 is_xen=1 elif [ -f /proc/xen/capabilities ]; then @@ -109,7 +117,10 @@ if [ ! "$is_xen" ]; then # uses QEMU for its device model. if grep -q 'QEMU' /proc/cpuinfo; then - # XXX How to distinguish between QEMU & KVM? - echo qemu + if [ "$cpuid" = "KVMKVMKVM" ]; then + echo kvm + else + echo qemu + fi fi fi