|   | 
      | 
  
  
      | 
      | 
  
 
     | 
    | 
  
  
     | 
    | 
  
  
    |   | 
      | 
  
  
    | 
         
xen-devel
Re: [Xen-devel] [RFC] Is this process running on which machine?
 
On Sat, Nov 18, 2006 at 06:10:57PM +0900, Akio Takebe wrote:
> Hi, all
> 
> I'd like to know "Is this process running on which machine?"
> For example, a native machien, or dom0, or domU, or HVM..
> 
> So I research codes of xen,
> then I make the following shell.
> (I haven't confirmed HVM yet because I don't use VTx machine.)
> What do you think about it?
> 
> =========================================================================
> #!/bin/bash
> 
> if [ -d /sys/hypervisor ] ; then
>         UUID=$(cat /sys/hypervisor/uuid)
>         if [ x"$UUID" == x"00000000-0000-0000-0000-000000000000" ]; then
>                 echo "this is dom0."
>         else
>                 echo "this is domU."
>         fi
> else
>         IS_HVM=$(strings /proc/acpi/dsdt | grep -i xen)
>         if [ x"IS_HVM" != x ]; then
>                 echo "this is hvm machine"
>         else
>                 echo "this is native machine"
>         fi
> fi
I wouldn't rely upon the UUID of domain 0 being all-zeros -- there have
been arguments about that in the past.
The proper mechanism for doing this is
grep -q "control_d" /proc/xen/capabilities
This will be true if you are in the "initial control domain"
(SIF_INITDOMAIN has been set).
Ewan.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
 
 |   
 
 | 
    | 
  
  
    |   | 
    |