* [RFC] Is this process running on which machine?
@ 2006-11-18 9:10 Akio Takebe
2006-11-18 13:53 ` Ewan Mellor
0 siblings, 1 reply; 8+ messages in thread
From: Akio Takebe @ 2006-11-18 9:10 UTC (permalink / raw)
To: xen-devel
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
=========================================================================
Best Regards,
Akio Takebe
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFC] Is this process running on which machine?
2006-11-18 9:10 [RFC] Is this process running on which machine? Akio Takebe
@ 2006-11-18 13:53 ` Ewan Mellor
2006-11-20 1:57 ` Akio Takebe
0 siblings, 1 reply; 8+ messages in thread
From: Ewan Mellor @ 2006-11-18 13:53 UTC (permalink / raw)
To: Akio Takebe; +Cc: xen-devel
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.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFC] Is this process running on which machine?
2006-11-18 13:53 ` Ewan Mellor
@ 2006-11-20 1:57 ` Akio Takebe
2006-11-20 3:37 ` Akio Takebe
0 siblings, 1 reply; 8+ messages in thread
From: Akio Takebe @ 2006-11-20 1:57 UTC (permalink / raw)
To: Ewan Mellor; +Cc: xen-devel, 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@lists.xensource.com
>http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFC] Is this process running on which machine?
2006-11-20 1:57 ` Akio Takebe
@ 2006-11-20 3:37 ` Akio Takebe
2006-11-21 3:03 ` Andrew D. Ball
0 siblings, 1 reply; 8+ messages in thread
From: Akio Takebe @ 2006-11-20 3:37 UTC (permalink / raw)
To: Ewan Mellor; +Cc: xen-devel, Akio Takebe
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@lists.xensource.com
>>http://lists.xensource.com/xen-devel
>
>
>_______________________________________________
>Xen-devel mailing list
>Xen-devel@lists.xensource.com
>http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFC] Is this process running on which machine?
2006-11-20 3:37 ` Akio Takebe
@ 2006-11-21 3:03 ` Andrew D. Ball
2006-11-21 8:52 ` Akio Takebe
0 siblings, 1 reply; 8+ messages in thread
From: Andrew D. Ball @ 2006-11-21 3:03 UTC (permalink / raw)
To: Akio Takebe; +Cc: xen-devel, Ewan Mellor
You can use dmidecode on HVM domU's running Linux. This reads the
SMBIOS tables. The system information type (type 1) will tell you that
it's an HVM domU.
Peace.
Andrew
On Mon, 2006-11-20 at 12:37 +0900, Akio Takebe wrote:
> 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@lists.xensource.com
> >>http://lists.xensource.com/xen-devel
> >
> >
> >_______________________________________________
> >Xen-devel mailing list
> >Xen-devel@lists.xensource.com
> >http://lists.xensource.com/xen-devel
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFC] Is this process running on which machine?
2006-11-21 3:03 ` Andrew D. Ball
@ 2006-11-21 8:52 ` Akio Takebe
2006-11-27 4:39 ` Akio Takebe
0 siblings, 1 reply; 8+ messages in thread
From: Akio Takebe @ 2006-11-21 8:52 UTC (permalink / raw)
To: aball; +Cc: Akio Takebe, xen-devel, Ewan Mellor
Hi, Andrew
Thank you for you comment.
>You can use dmidecode on HVM domU's running Linux. This reads the
>SMBIOS tables. The system information type (type 1) will tell you that
>it's an HVM domU.
Yes, dmidecode is a good way.
The following way is also another good way.
lspci | grep "5853:0001"
I'll remake the scripts.
I'd like to make a command like "uname".
Best Regars,
Akio Takebe
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFC] Is this process running on which machine?
2006-11-21 8:52 ` Akio Takebe
@ 2006-11-27 4:39 ` Akio Takebe
2006-11-28 4:00 ` Akio Takebe
0 siblings, 1 reply; 8+ messages in thread
From: Akio Takebe @ 2006-11-27 4:39 UTC (permalink / raw)
To: aball; +Cc: Akio Takebe, xen-devel, Ewan Mellor
Hi,
I remake my scripts.
I found dmidecode sometimes don't work on HVM domain
and it is not installed on default system of some distribution.
So I use /proc/acpi/dsdt.
Please comments.
===================================================================
#!/bin/bash
IS_X86HVM="$(strings /proc/acpi/dsdt | grep int-xen)"
if [ x"${IS_X86HVM}" != x ]; then
echo "this is x86 hvm machine"
elif [ -f /proc/xen/capabilities ] ; then
if $(grep -q control_d /proc/xen/capabilities); then
echo "this is dom0."
else
echo "this is domU."
fi
else
echo "this is native machine"
fi
===================================================================
Best Regards,
Akio Takebe
>Hi, Andrew
>
>Thank you for you comment.
>
>>You can use dmidecode on HVM domU's running Linux. This reads the
>>SMBIOS tables. The system information type (type 1) will tell you that
>>it's an HVM domU.
>Yes, dmidecode is a good way.
>The following way is also another good way.
>lspci | grep "5853:0001"
>
>I'll remake the scripts.
>I'd like to make a command like "uname".
>
>Best Regars,
>
>Akio Takebe
>
>
>
>_______________________________________________
>Xen-devel mailing list
>Xen-devel@lists.xensource.com
>http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFC] Is this process running on which machine?
2006-11-27 4:39 ` Akio Takebe
@ 2006-11-28 4:00 ` Akio Takebe
0 siblings, 0 replies; 8+ messages in thread
From: Akio Takebe @ 2006-11-28 4:00 UTC (permalink / raw)
To: xen-devel, Ewan Mellor, Andrew D. Ball; +Cc: Akio Takebe
Hi,
I remake it again.
I tested native, dom0, domU, domVTx on x86.
If you have comments, please give me.
----------------------------------------------------------
#!/bin/bash
declare -i IS_HVM=0
declare -i IS_PARA=0
check_hvm()
{
IS_X86HVM="$(strings /proc/acpi/dsdt | grep int-xen)"
if [ x"${IS_X86HVM}" != x ]; then
echo "x86hvm"
IS_HVM=1
fi
}
check_para()
{
if $(grep -q control_d /proc/xen/capabilities); then
echo "dom0"
IS_PARA=1
else
echo "domU"
IS_PARA=1
fi
}
#### main ####
if [ -f /proc/acpi/dsdt ]; then
check_hvm
fi
if [ ${IS_HVM} -eq 0 ]; then
if [ -f /proc/xen/capabilities ] ; then
check_para
fi
fi
if [ ${IS_HVM} -eq 0 -a ${IS_PARA} -eq 0 ]; then
echo "native"
fi
----------------------------------------------------------
Best Regards,
Akio Takebe
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2006-11-28 4:00 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-18 9:10 [RFC] Is this process running on which machine? Akio Takebe
2006-11-18 13:53 ` Ewan Mellor
2006-11-20 1:57 ` Akio Takebe
2006-11-20 3:37 ` Akio Takebe
2006-11-21 3:03 ` Andrew D. Ball
2006-11-21 8:52 ` Akio Takebe
2006-11-27 4:39 ` Akio Takebe
2006-11-28 4:00 ` Akio Takebe
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.