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] Shell test for pv vs hvm (vs dom0)

To: Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>
Subject: Re: [Xen-devel] Shell test for pv vs hvm (vs dom0)
From: Alex Williamson <alex.williamson@xxxxxx>
Date: Mon, 25 Feb 2008 05:58:28 -0700
Cc: "dan.magenheimer@xxxxxxxxxx" <dan.magenheimer@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Mon, 25 Feb 2008 04:58:48 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <C3E58772.14462%Keir.Fraser@xxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: OSLO R&D
References: <C3E58772.14462%Keir.Fraser@xxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Sat, 2008-02-23 at 08:18 +0000, Keir Fraser wrote:
> There's no general way to discriminate between HVM and native from a shell
> script. You might discriminate between HVM and PV on Linux by looking for
> /sys/hypervisor or /proc/xen.

Isn't something like this generally sufficient for a shell script?

lspci -n | grep -q "5853:0001"
if [ $? -eq 0 ]; then
        # HVM domain
elif [ -d /proc/xen ]; then
        if grep -q "control_d" /proc/xen/capabilities; then
                # DOM0
        else
                # DOMU
        fi
else
        # Native
fi

It seems fairly reliable on ia64 for Xen 3.x.  Thanks,

        Alex

-- 
Alex Williamson                             HP Open Source & Linux Org.


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