From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Bainbridge Subject: Re: simple check for domU? Date: Fri, 11 Nov 2005 20:33:04 +0000 Message-ID: <623652d50511111233n6bc7d9en@mail.gmail.com> References: <623652d50511101623q533a8e04r@mail.gmail.com> <5d7aca950511111014je734b7fxe5ce488cd6573bd5@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <5d7aca950511111014je734b7fxe5ce488cd6573bd5@mail.gmail.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: NAHieu Cc: Xen development list List-Id: xen-devel@lists.xenproject.org On 11/11/05, NAHieu wrote: > On 11/11/05, Chris Bainbridge wrote: > > Hi, is there a simple way to check that we're running under a domU? So > > far I came up with: > > > > [[ -d /proc/xen && ! -z `ls /sys/bus/xen/devices/` ]] > > > > or > > > > -e /sys/bus/xen/drivers/vbd || -e /sys/bus/xen/drivers/vif > > > > Neither of which is pretty, and I'm not convinced they work under all > > circumstances. This is useful for system setup scripts to do different > > things depending if they are run under dom0/U. > > That is easy. Something you will never see in domU, such as > xenconsoled, xenstored,... > > So check for the presence of these daemons is a good way, especially > that requires no privileged access. It is quite possible that someone has these daemons installed in a domU fs. Maybe you mean check if the process is running? Even that is problematic; it's possible to run a xen0 kernel without those daemons. Besides, how do we differentiate between a domU kernel and a standard kernel? If there's no easy and reliable way to do this maybe one should be added?