Richard W.M. Jones
2008-Aug-27 17:09 UTC
[Fedora-xen] ANNOUNCE: virt-what 1.0 - a shell script to detect if you are running in a virtual machine
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). Rich. -- 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. http://et.redhat.com/~rjones/virt-top
Steve Thompson
2008-Aug-30 20:21 UTC
Re: [Fedora-xen] ANNOUNCE: virt-what 1.0 - a shell script to detect if you are running in a virtual machine
On Wed, 27 Aug 2008, Richard W.M. Jones wrote:> 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. > [...]On dom0 running a xen kernel (CentOS 5.2), I get: xen xen-dom0 whether or not xend is started. On PV guests, I get the same output (they have /proc/xen/privcmd too). On HVM guests, I get no output. Steve ---------------------------------------------------------------------------- Steve Thompson E-mail: smt AT vgersoft DOT com Voyager Software LLC Web: http://www DOT vgersoft DOT com 39 Smugglers Path VSW Support: support AT vgersoft DOT com Ithaca, NY 14850 "186,300 miles per second: it''s not just a good idea, it''s the law" ----------------------------------------------------------------------------
Richard W.M. Jones
2008-Aug-31 18:00 UTC
Re: [Fedora-xen] ANNOUNCE: virt-what 1.0 - a shell script to detect if you are running in a virtual machine
On Sat, Aug 30, 2008 at 04:21:31PM -0400, Steve Thompson wrote:> On Wed, 27 Aug 2008, Richard W.M. Jones wrote: > >> 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. >> [...] > > On dom0 running a xen kernel (CentOS 5.2), I get: > > xen > xen-dom0 > > whether or not xend is started. > On PV guests, I get the same output (they have /proc/xen/privcmd > too). On HVM guests, I get no output.Oh dear, that''s a bug. Which version of xen are you running? Rich. -- 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. http://et.redhat.com/~rjones/virt-top