Is there a standard idiom most folks use to ask the question: Am I a linux that was just booted under Xen? I''m thinking about fooling with some of my alternate boot partitions so they can be booted as paravirt VMs, but they''d need to do a bit of reconfiguring of themselves when running under Xen early in the boot process (like not trying to mount other partitions that are gonna be used by other virtual machines and use a different host name, and don''t start so many system services, etc). I suppose I could just check and see if the kernel name has "xen" in it, but I just wondered if there was one true way to ask this question. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Tom Horsley wrote:> Is there a standard idiom most folks use to ask the > question: Am I a linux that was just booted under Xen? > > I''m thinking about fooling with some of my alternate > boot partitions so they can be booted as paravirt > VMs, but they''d need to do a bit of reconfiguring > of themselves when running under Xen early in the boot > process (like not trying to mount other partitions > that are gonna be used by other virtual machines > and use a different host name, and don''t start so many > system services, etc). > > I suppose I could just check and see if the kernel > name has "xen" in it, but I just wondered if there > was one true way to ask this question. >This is actually a question I''ve also found myself asking... I''ve got a couple custom-built Debian packages that unroll various configurations onto VMs, dom0s, and regular machines... I find myself writing in all sorts of weird checks to try and determine what it is (and always am finding new loopholes that I need to close). If there is a nice guaranteed way of detecting a Paravirtualized domU (or if the machine is acting as a dom0), I would also be interested in knowing (basing it off strings in the kernel name isn''t necessarily 100% guaranteed). -Matthew -- Matthew Haas Visiting Instructor Corning Community College Computer & Information Science http://lab46.corning-cc.edu/haas/home/ "Writing should be like breathing; It is one of those important things we do." -- me _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
On Sun, Mar 2, 2008 at 10:01 PM, Matthew Haas <haas@corning-cc.edu> wrote:> Tom Horsley wrote: > > Is there a standard idiom most folks use to ask the > > question: Am I a linux that was just booted under Xen? > > > > I''m thinking about fooling with some of my alternate > > boot partitions so they can be booted as paravirt > > VMs, but they''d need to do a bit of reconfiguring > > of themselves when running under Xen early in the boot > > process (like not trying to mount other partitions > > that are gonna be used by other virtual machines > > and use a different host name, and don''t start so many > > system services, etc). > > > > I suppose I could just check and see if the kernel > > name has "xen" in it, but I just wondered if there > > was one true way to ask this question. > > >This thread might be useful http://xen.markmail.org/search/?q=Shell%20test%20for%20pv%20vs%20hvm#query:Shell%20test%20for%20pv%20vs%20hvm+page:1+mid:nqh2wxik3qqqyugp+state:results In particular, Alex Williamson has a little script that seems to do the detection. Regards, Todd> > This is actually a question I''ve also found myself asking... I''ve got > a couple custom-built Debian packages that unroll various configurations > onto VMs, dom0s, and regular machines... I find myself writing in all > sorts of weird checks to try and determine what it is (and always am > finding new loopholes that I need to close). > > If there is a nice guaranteed way of detecting a Paravirtualized domU > (or if the machine is acting as a dom0), I would also be interested in > knowing (basing it off strings in the kernel name isn''t necessarily 100% > guaranteed). > > -Matthew > -- > Matthew Haas > Visiting Instructor > Corning Community College > Computer & Information Science > http://lab46.corning-cc.edu/haas/home/ > > "Writing should be like breathing; > It is one of those important things we do." -- me > > _______________________________________________ > Xen-users mailing list > Xen-users@lists.xensource.com > http://lists.xensource.com/xen-users >_______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Matthew Haas wrote:> Tom Horsley wrote: >> Is there a standard idiom most folks use to ask the >> question: Am I a linux that was just booted under Xen? >> >> > > > If there is a nice guaranteed way of detecting a Paravirtualized domU > (or if the machine is acting as a dom0), I would also be interested in > knowing (basing it off strings in the kernel name isn''t necessarily > 100% guaranteed).What RH did : "if [ -e /proc/xen/xsd_kva -o ! -d /proc/xen ]; then" First part detects a xen dom0, second part detects a native Linux. To detect domU, you could put the code in the "else" part, or invert the test, e.g. "if [ -d /proc/xen -a ! -e /proc/xen/xsd_kva ]; then" Regards, Fajar _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
On Sunday 02 March 2008 09:56:54 pm Tom Horsley wrote:> Is there a standard idiom most folks use to ask the > question: Am I a linux that was just booted under Xen?Probably the existence of /proc/xen, altho that''s true for dom0 also. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Hi, On Sun, Mar 02, 2008 at 11:05:01PM -0500, jim burns wrote:> On Sunday 02 March 2008 09:56:54 pm Tom Horsley wrote: > > Is there a standard idiom most folks use to ask the > > question: Am I a linux that was just booted under Xen? > > Probably the existence of /proc/xen, altho that''s true for dom0 also.You can test whether you are dom0 or domU by looking at /proc/xen/capabilities. A modified dom0 can of course lie to you about this though, so it isn''t a very satisfactory answer to the hypothetical philosophical question of "are we in a virtual machine?" Unfortunately there is no Morpheus with the blue and red pills. Cheers, Andy _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
jim burns wrote:> On Sunday 02 March 2008 09:56:54 pm Tom Horsley wrote: > >> Is there a standard idiom most folks use to ask the >> question: Am I a linux that was just booted under Xen? >> > > Probably the existence of /proc/xen, altho that''s true for dom0 also. >Better you check the value of /sys/hypervisor/uuid. If it''s all zeros, then it would be dom0, otherwise a paravirtualized domU. To check whether it''s a fully virtualized guest or not, you need to check the output of "dmidecode" from within the guest. An HVM guest''s dmidecode should show as below Handle 0x0100 DMI type 1, 27 bytes. System Information Manufacturer: Xen Product Name: HVM domU Version: 3.1.0-53.1.13.el5 Serial Number: 1298ca87-b138-d1c5-026a-8e2d79c70602 UUID: 1298CA87-B138-D1C5-026A-8E2D79C70602 Wake-up Type: Power Switch --Sadique> _______________________________________________ > Xen-users mailing list > Xen-users@lists.xensource.com > http://lists.xensource.com/xen-users > >_______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Fajar A. Nugraha wrote:> Matthew Haas wrote: >> Tom Horsley wrote: >>> Is there a standard idiom most folks use to ask the >>> question: Am I a linux that was just booted under Xen? >>> >>> >> >> >> If there is a nice guaranteed way of detecting a Paravirtualized >> domU (or if the machine is acting as a dom0), I would also be >> interested in knowing (basing it off strings in the kernel name isn''t >> necessarily 100% guaranteed). > > What RH did : > "if [ -e /proc/xen/xsd_kva -o ! -d /proc/xen ]; then" > > First part detects a xen dom0, second part detects a native Linux. > To detect domU, you could put the code in the "else" part, or invert > the test, e.g. > > "if [ -d /proc/xen -a ! -e /proc/xen/xsd_kva ]; then" > > Regards, > > FajarAlso, if you have a well-defined practice of using the Xen-provided prefix in your MAC addresses, you can identify them that way, at least on localhost. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users