From: "Karsten M. Self" Subject: Re: simple check for domU? Date: Thu, 10 Nov 2005 17:52:28 -0800 Message-ID: <20051111015228.GC3558@karstenlx.eng.hq.xensource.com> References: <623652d50511101623q533a8e04r@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <623652d50511101623q533a8e04r@mail.gmail.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org on Fri, Nov 11, 2005 at 12:23:18AM +0000, Chris Bainbridge (chris.bainbridge@gmail.com) wrote: > Hi, is there a simple way to check that we're running under a domU? So > far I came up with: Try: uname -r | grep -q -- -xen ... which generally works. 'test -d /proc/xen' is pretty reliable as well. > [[ -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. > > Thanks, > Chris > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel -- Karsten M. Self XenSource, Inc. 2300 Geng Road #250 +1 650.798.5900 x259 Palo Alto, CA 94303 +1 650.493.1579 fax