[virt-tools-list] Virt-what support for UML and Virtualbox

Laurent Léonard laurent at open-minds.org
Tue Aug 4 10:50:10 UTC 2009


Le mardi 04 août 2009 à 11:00, Daniel P. Berrange a écrit :
> On Tue, Aug 04, 2009 at 01:28:20AM +0200, Laurent L?onard wrote:
> > Hi,
> >
> > You can find attached "cat /proc/cpuid" outputs from UML and VirtualBox
> > environments.
> >
> > For UML, the following code should do the trick:
> > if grep -q 'UML' /proc/cpuinfo; then
> >     echo uml
> > fi
> >
> > For Virtualbox, the CPU vendor and model seem to be the same as the host
> > but the output is not exactly the same as the host. I'm not sure those
> > differences can be used to make sure we are running in a VirtualBox
> > virtual machine.
>
> You might want to investigate the 'dmidecode' output when run within
> virtualbox. That may well have useful info you can hook onto. The
> cpuinfo file you give below doesn't appear to have any useful virtualbox
> specific item you can hook into.

You can find attached dmidecode output from VirtualBox environment. There is 
no "cat /dev/mem" in UML environment so no dmidecode output.

For VirtualBox, the following code should do the trick:

if echo "$dmi" | grep -q 'Manufacturer: innotek GmbH'; then
    echo virtualbox
fi

-- 
Laurent Léonard
-------------- next part --------------
# dmidecode 2.9
SMBIOS 2.5 present.
3 structures occupying 256 bytes.
Table at 0x000E1000.

Handle 0x0000, DMI type 0, 20 bytes
BIOS Information
	Vendor: innotek GmbH
	Version: VirtualBox
	Release Date: 12/01/2006
	Address: 0xE0000
	Runtime Size: 128 kB
	ROM Size: 128 kB
	Characteristics:
		ISA is supported
		PCI is supported
		Boot from CD is supported
		Selectable boot is supported
		8042 keyboard services are supported (int 9h)
		CGA/mono video services are supported (int 10h)
		ACPI is supported

Handle 0x0001, DMI type 1, 27 bytes
System Information
	Manufacturer: innotek GmbH
	Product Name: VirtualBox
	Version: 1.2
	Serial Number: 0
	UUID: 2DDA119E-ED1E-40D1-9937-18A59C07F8D8
	Wake-up Type: Power Switch
	SKU Number: Not Specified
	Family: Virtual Machine

Handle 0xFFFF, DMI type 127, 124 bytes
End Of Table

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20090804/4a1c9699/attachment.sig>


More information about the virt-tools-list mailing list