There are a few ways that you can determine that you're in a virtual platform.
First, if the platform is PV platform, you either use uname to find the kernel
name (usually contains a reference to Xen) or look for the /proc/xen directory.
You can also look in /sys/hypervisor/type, which exists on Xen platforms. On
PV domUs, /proc/xen/capabilities should be empty - on dom0 it will have the
various available types of domUs listed. Of course, this is mainly for
Linux-based PV domUs - other platforms will have indications elsewhere.
For HVM domUs it's much harder to tell - probably the best way is to look at
the hardware specs and see if they match what Xen (Qemu) emulates as hardware.
Since many HVM kernels are not "aware" of the fact that they are running as
virtual machines, there isn't necessarily anything you can look for to make
that determination. Some HVM domUs run PV drivers (e.g. the Windows GPL PV
drivers) that could tip you off, but it just depends on the configuration of
the domU kernel and drivers.
-Nick
>>> On 2009/12/21 at 11:22, Sachin Goel <SACHIN.GOEL@xxxxxxxxxx> wrote:
> Does anybody has an idea about this ??
>
> - Thanks,
> Sachin.
>
> ----- Original Message -----
> From: sachin.goel@xxxxxxxxxx
> To: xen-users@xxxxxxxxxxxxxxxxxxx
> Sent: Monday, December 21, 2009 10:51:45 PM GMT +05:30 Chennai, Kolkata,
> Mumbai, New Delhi
> Subject: [Xen-users] How to detect if a machine is a Virtual machine ??
>
> Hi,
>
> Just curious to know, if there is any way that given a terminal to a
> box, we can determine is it a physical machine or a virtual machine ?
>
> Thanks,
> Sachin.
>
> _______________________________________________
> Xen-users mailing list
> Xen-users@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-users
--------
This e-mail may contain confidential and privileged material for the sole use
of the intended recipient. If this email is not intended for you, or you are
not responsible for the delivery of this message to the intended recipient,
please note that this message may contain SEAKR Engineering (SEAKR)
Privileged/Proprietary Information. In such a case, you are strictly
prohibited from downloading, photocopying, distributing or otherwise using this
message, its contents or attachments in any way. If you have received this
message in error, please notify us immediately by replying to this e-mail and
delete the message from your mailbox. Information contained in this message
that does not relate to the business of SEAKR is neither endorsed by nor
attributable to SEAKR.
_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users
|