WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [RFC] Is this process running on which machine?

Hi, Ewan and all

Using /proc/xen is not good 
because unmodified driver create /proc/xen on HVM.
Which is better?
    A. chech existing /proc/xen/capabilities
    B. check existing /sys/hypervisor?

I feel A is better. 
But will xen support privcmd as unmodified driver in the future?
How do you think about it?

Best Regards,

Akio Takebe

>Hi, Ewan and all
>
>Thank you for your comments.
>I remake my scripts.
>
>I tested on dom0,domU,HVM(x86),native.
>Are there any other comments or suggestions?
>
>=================================================================
>#!/bin/bash
>
>if [ -d /proc/xen ] ; then
>        if $(grep -q control_d /proc/xen/capabilities); then
>                echo "this is dom0."
>        else
>                echo "this is domU."
>        fi
>else
>        IS_X86HVM="$(strings /proc/acpi/dsdt | grep int-xen)"
>        if [ x"${IS_X86HVM}" != x ]; then
>                echo "this is x86 hvm machine"
>        else
>                echo "this is native machine"
>        fi
>fi
>=================================================================
>
>Best Regards,
>
>Akio Takebe
>
>>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
>
>
>_______________________________________________
>Xen-devel mailing list
>Xen-devel@xxxxxxxxxxxxxxxxxxx
>http://lists.xensource.com/xen-devel


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel