Shell test for pv vs hvm (vs dom0)
Is there an "officially sanctioned" method for a shell script to test whether it is running on a native OS vs pv OS vs hvm OS (and possibly also dom0 OS)?
I know there are lots of different ways to determine this but am wondering if any one will work across all (recent and future) implementations of Xen and across multiple (at least Linux-based) distros.
If not, perhaps there could/should be a C/python tool in the Xen tree that does this?
===================================
If Xen could save time in a bottle / then clocks wouldn't virtually skew / It would save every tick / for VMs that aren't quick /
and Xen then would send them anew
(with apologies to the late great Jim Croce)
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
It's not a shell script, but tools/misc/xen-detect.c will do what you want on x86 platforms. To detect a Linux dom0 you can check for 'control_d' in /proc/xen/capabilities.
-- Keir
Quoted 21 lines · Dan Magenheimer
Is there an "officially sanctioned" method for a shell script to test whether it is running on a native OS vs pv OS vs hvm OS (and possibly also dom0 OS)?
I know there are lots of different ways to determine this but am wondering if any one will work across all (recent and future) implementations of Xen and across multiple (at least Linux-based) distros.
If not, perhaps there could/should be a C/python tool in the Xen tree that does this?
===================================
If Xen could save time in a bottle / then clocks wouldn't virtually skew / It would save every tick / for VMs that aren't quick /
and Xen then would send them anew
(with apologies to the late great Jim Croce)
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Thanks for pointing this tool out! Looks useful.
Unfortunately, for it to be broadly useful, it would have to ship with all distros as compiling it "on demand" on the guest is often not an option.
Porting xen-detect to shell script doesn't look possible since it uses inline assembly.
Any other ideas?
Quoted 44 lines
-----Original Message-----
From: Keir Fraser [mailto:[email protected]]
Sent: Friday, February 22, 2008 2:18 PM
To: [email protected]; [email protected]
Subject: Re: [Xen-devel] Shell test for pv vs hvm (vs dom0)It's not a shell script, but
tools/misc/xen-detect.cwill do what you want
on x86 platforms. To detect a Linux dom0 you can check for 'control_d' in/proc/xen/capabilities.-- Keir
Quoted 10 lines · Dan Magenheimer
Is there an "officially sanctioned" method for a shell script to test whether it is running on a native OS vs pv OS vs hvm OS (and possibly also dom0 OS)?
I know there are lots of different ways to determine this but am wondering if any one will work across all (recent and future) implementations of Xen and across multiple (at least Linux-based) distros.
If not, perhaps there could/should be a C/python tool in
the Xen tree
Quoted 4 lines
that does this?
===================================
If Xen could save time in a bottle / then clocks wouldn'tvirtually skew /
Quoted 7 lines
It would save every tick / for VMs that aren't quick / and Xen then would send them anew
(with apologies to the late great Jim Croce)
_______________________________________________
Xen-devel mailing list [email protected]
http://lists.xensource.com/xen-devel
I don't know, but does libvirt API has any xen compatible methods for your requirements?
Just guessing, please feel free to correct me.
Thanks,
--Pradeep
Quoted 63 lines · Dan Magenheimer
Thanks for pointing this tool out! Looks useful.
Unfortunately, for it to be broadly useful, it would have to ship with all distros as compiling it "on demand" on the guest is often not an option.
Porting xen-detect to shell script doesn't look possible since it uses inline assembly.
Any other ideas?
Quoted 27 lines
-----Original Message-----
From: Keir Fraser [mailto:[email protected]]
Sent: Friday, February 22, 2008 2:18 PM
To: [email protected]; [email protected]
Subject: Re: [Xen-devel] Shell test for pv vs hvm (vs dom0)It's not a shell script, but
tools/misc/xen-detect.cwill do what you want
on x86 platforms. To detect a Linux dom0 you can check for 'control_d' in/proc/xen/capabilities.-- Keir
Quoted 9 lines · Dan Magenheimer
Is there an "officially sanctioned" method for a shell script to test whether it is running on a native OS vs pv OS vs hvm OS (and possibly also dom0 OS)?
I know there are lots of different ways to determine this but am wondering if any one will work across all (recent and future) implementations of Xen and across multiple (at least Linux-based) distros.
Quoted 17 lines
Quoted 1 line
If not, perhaps there could/should be a C/python tool in
the Xen tree
Quoted 4 lines
that does this?
===================================
If Xen could save time in a bottle / then clocks wouldn'tvirtually skew /
Quoted 7 lines
It would save every tick / for VMs that aren't quick / and Xen then would send them anew
(with apologies to the late great Jim Croce)
_______________________________________________
Xen-devel mailing list [email protected]
http://lists.xensource.com/xen-devel_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Signature · 3 lines
Pradeep Singh Rautela http://eagain.wordpress.com http://emptydomain.googlepages.com
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.
-- Keir
Quoted 56 lines · Dan Magenheimer
Thanks for pointing this tool out! Looks useful.
Unfortunately, for it to be broadly useful, it would have to ship with all distros as compiling it "on demand" on the guest is often not an option.
Porting xen-detect to shell script doesn't look possible since it uses inline assembly.
Any other ideas?
Quoted 44 lines
-----Original Message-----
From: Keir Fraser [mailto:[email protected]]
Sent: Friday, February 22, 2008 2:18 PM
To: [email protected]; [email protected]
Subject: Re: [Xen-devel] Shell test for pv vs hvm (vs dom0)It's not a shell script, but
tools/misc/xen-detect.cwill do what you want
on x86 platforms. To detect a Linux dom0 you can check for 'control_d' in/proc/xen/capabilities.-- Keir
Quoted 10 lines · Dan Magenheimer
Is there an "officially sanctioned" method for a shell script to test whether it is running on a native OS vs pv OS vs hvm OS (and possibly also dom0 OS)?
I know there are lots of different ways to determine this but am wondering if any one will work across all (recent and future) implementations of Xen and across multiple (at least Linux-based) distros.
If not, perhaps there could/should be a C/python tool in
the Xen tree
Quoted 4 lines
that does this?
===================================
If Xen could save time in a bottle / then clocks wouldn'tvirtually skew /
Quoted 7 lines
It would save every tick / for VMs that aren't quick / and Xen then would send them anew
(with apologies to the late great Jim Croce)
_______________________________________________
Xen-devel mailing list [email protected]
http://lists.xensource.com/xen-devel
Could it be possible to define some bios magic for "hardware vendor"? So a HVM Guest would ask "What hardware am I running on?"
Just a thought...
Quoted 4 lines · Keir Fraser
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/hypervisoror/proc/xen.
Quoted 9 lines
-- Keir
Quoted 5 lines · Dan Magenheimer
Thanks for pointing this tool out! Looks useful.
Unfortunately, for it to be broadly useful, it would have to ship with all distros as compiling it "on demand" on the guest is often not an option.
begin:vcard
fn:Stephan Seitz
n:Seitz;Stephan
org:netz-haut e.K.
adr:;;Zweierweg 22;Wuerzburg;Bayern;97074;Deutschland email;internet:[email protected] title:Senior System Administrator tel;work:+49-931-287-6247 tel;fax:+49-931-287-6248
x-mozilla-html:FALSE url:http://www.schwarz-mode.de/files/ version:2.1
end:vcard
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
There's already HVM strings in SMBIOS and ACPI tables, but they're not particularly accessible from shell scripts in a generic way.
-- Keir
Quoted 21 lines · Stephan Seitz
Could it be possible to define some bios magic for "hardware vendor"? So a HVM Guest would ask "What hardware am I running on?"
Just a thought...
Quoted 13 lines · Keir Fraser
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/hypervisoror/proc/xen.-- Keir
Quoted 5 lines · Dan Magenheimer
Thanks for pointing this tool out! Looks useful.
Unfortunately, for it to be broadly useful, it would have to ship with all distros as compiling it "on demand" on the guest is often not an option.
Perhaps there's something in sysfs or proc somewhere that could discern between HVM and native?
Quoted 1 line
Quoted 1 line
So a HVM Guest would ask "What hardware am I running on?"
Interestingly, I just ran across a place in 2.6.18-based guests (e.g. RHEL5) in the timer code where a test is made whether an Intel or AMD "box" is being booted to decide whether or not to trust that TSC will be syncrhonized across multiple cpus. Obviously this test is invalid for virtual machines (though in this case, it is probably correct "most" of the time).
Quoted 44 lines
-----Original Message-----
From: Keir Fraser [mailto:[email protected]]
Sent: Saturday, February 23, 2008 7:36 AM
To: Stephan Seitz
Cc: [email protected]; [email protected]
Subject: Re: [Xen-devel] Shell test for pv vs hvm (vs dom0)There's already HVM strings in SMBIOS and ACPI tables, but they're not particularly accessible from shell scripts in a generic way.
-- Keir
Quoted 1 line · Stephan Seitz
Could it be possible to define some bios magic for
"hardware vendor"?
Quoted 6 lines
So a HVM Guest would ask "What hardware am I running on?"
Just a thought...
Quoted 1 line · Keir Fraser
There's no general way to discriminate between HVM and
native from a shell
Quoted 1 line
Quoted 1 line
script. You might discriminate between HVM and PV on Linux
by looking for
Quoted 5 lines
Quoted 5 lines
/sys/hypervisoror/proc/xen.-- Keir
On 22/2/08 22:38, "Dan Magenheimer"
Quoted 8 lines · <[email protected]> wrote:
Quoted 6 lines
Quoted 6 lines
Thanks for pointing this tool out! Looks useful.
Unfortunately, for it to be broadly useful, it would have to ship with all distros as compiling it "on demand" on the guest is often not an option.
Quoted 3 lines · Keir Fraser
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/hypervisoror/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
Signature · 1 line
Alex Williamson HP Open Source & Linux Org.
Yes, that should work for Linux just fine I think.
-- Keir
Quoted 24 lines · Alex Williamson
Quoted 3 lines · Keir Fraser
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/hypervisoror/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
fiIt seems fairly reliable on ia64 for Xen 3.x. Thanks,
Alex
Quoted 1 line · Keir Fraser
Yes, that should work for Linux just fine I think.
On x86 at least you also have the option of using dmidecode to detect an HVM guest, looking for 'Xen' in the 'System Information' block.
And the 'xen-detect' command in tools/misc/ provides another way to detect presence of Xen PV vs HVM.
Quoted 33 lines · Alex Williamson
Quoted 22 lines · Keir Fraser
Quoted 3 lines
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/hypervisoror/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
fiQuoted 3 lines
It seems fairly reliable on ia64 for Xen 3.x. Thanks,
Alex
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Signature · 4 lines
|=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|
Thanks much! These are great!
Quoted 65 lines
-----Original Message-----
From: Daniel P. Berrange [mailto:[email protected]]
Sent: Monday, February 25, 2008 6:46 AM
To: Keir Fraser
Cc: Alex Williamson; [email protected]; [email protected]
Subject: Re: [Xen-devel] Shell test for pv vs hvm (vs dom0)Quoted 1 line · Keir Fraser
Yes, that should work for Linux just fine I think.
On x86 at least you also have the option of using dmidecode to detect an
HVM guest, looking for 'Xen' in the 'System Information' block.And the 'xen-detect' command in
tools/misc/provides another way to detect presence of Xen PV vs HVM.Quoted 5 lines · Alex Williamson
Quoted 4 lines · Keir Fraser
Quoted 1 line
There's no general way to discriminate between HVM and
native from a shell
Quoted 1 line
Quoted 1 line
Quoted 1 line
script. You might discriminate between HVM and PV on
Linux by looking for
Quoted 19 lines
Quoted 19 lines
Quoted 1 line
/sys/hypervisoror/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
fiIt seems fairly reliable on ia64 for Xen 3.x. Thanks,
Quoted 8 lines
Quoted 1 line
Alex
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel--
|=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=|
|=- Perl modules: http://search.cpan.org/~danberr/-=| |=- Projects: http://freshmeat.net/~danielpb/ -=||=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF
F742 7D3B 9505 -=|