diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2011-05-26 15:40:59 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2011-05-26 15:55:41 +0100 |
commit | 3ea952163f0c28cd88f8473bb015df892c4247bf (patch) | |
tree | 8363809b506ac8f2aa32983d9f7a1c0037cc462e /virt-what.in | |
parent | 4fbbc8153ab74d5448bbb6d1113f1bc39f55402a (diff) | |
download | virt-what-3ea952163f0c28cd88f8473bb015df892c4247bf.tar.gz virt-what-3ea952163f0c28cd88f8473bb015df892c4247bf.tar.xz virt-what-3ea952163f0c28cd88f8473bb015df892c4247bf.zip |
Add IA64-specific tests for virtualization (RHBZ#707508).
Xen IA64 HVM does not provide a simple way to detect the
hypervisor.
If we are lucky and PV-on-HVM drivers are installed and loaded,
then there will be a /sys/bus/xen directory.
Otherwise we add a timing attack to see if we can detect generic
virtualization. Since this is a big hack, it is only enabled on IA64
and only used when all other methods of detection have failed.
This commit also adds `uname -p` to all tests (enabling arch detection
so we only run the above tests on IA64).
Diffstat (limited to 'virt-what.in')
-rw-r--r-- | virt-what.in | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/virt-what.in b/virt-what.in index a27be10..74ffab2 100644 --- a/virt-what.in +++ b/virt-what.in @@ -87,6 +87,11 @@ cpuid=`virt-what-cpuid-helper` dmi=`LANG=C dmidecode 2>&1` +# Architecture. +# Note for the purpose of testing, we only call uname with -p option. + +arch=`uname -p` + # Check for VMware. # cpuid check added by Chetan Loke. @@ -188,6 +193,22 @@ elif [ -f $root/sys/hypervisor/type ] && # enough information at present to tell whether this is dom0 # or domU. XXX echo xen +elif [ "$arch" = "ia64" ]; then + if [ -d $root/sys/bus/xen -a ! -d $root/sys/bus/xen-backend ]; then + # PV-on-HVM drivers installed in a Xen guest. + echo xen + echo xen-domU + else + # There is no virt leaf on IA64 HVM. This is a last-ditch + # attempt to detect something is virtualized by using a + # timing attack. + virt-what-ia64-xen-rdtsc-test > /dev/null 2>&1 + case "$?" in + 0) ;; # not virtual + 1) # Could be some sort of virt, or could just be a bit slow. + echo virt + esac + fi fi # Check for QEMU/KVM. |