[Fedora-xen] ANNOUNCE: virt-what 1.0 - a shell script to detect if you are running in a virtual machine

Richard W.M. Jones rjones at redhat.com
Wed Aug 27 17:09:20 UTC 2008

I'm pleased to announce the first release of 'virt-what', which is a
simple shell script that detects if you are running inside a virtual
machine, and prints some "facts" about that virtual machine.  This is
a frequently requested feature.

  Home page:        http://et.redhat.com/~rjones/virt-what/
  Source and RPMs:  http://et.redhat.com/~rjones/virt-what/files/

So far we can detect:

 - Xen
 - QEMU and KVM (but not distinguish between them)
 - VMware
 - Microsoft VirtualPC

I'm hoping that people who run or develop other virtualization
technology will be able to contribute snippets to detect those.

It's worth saying (before Dan Berrange says it anyway) that although
people often think they need this sort of feature, in most cases using
this script is the WRONG THING.  If you need a specific virtualization
feature, then add code to your application to detect that feature.
eg. If you need to make Xen hypervisor calls, your application should
try to open /proc/xen/privcmd.  As Dan once put it:

  A shell script just printing out 'native', 'dom0' or 'domU' is too
  simplistic to be broadly useful to management applications. The
  concepts are also ill-defined, eg 'native' as a concept can be a
  baremetal kernel, or a fully-virtualized guest, or both. 'DomU' does
  not distinguish full or paravirt. The distinction of 'dom0' vs
  'native' is irrelevant in non-Xen virtualization systems (eg KVM).


Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.

More information about the Fedora-xen mailing list