Skip to contentSkip to conversation

KVM Guest detection

DISCUSSION jd 3 participants 4 messages Aug 13, 2008 KVM

lore
Share & tools
lore

jd

author
#0 lore raw

Hi

Is there a way to detect if a particular machine is a VM running on KVM hypervisor or not. i.e from within a guest can one figure out if it is running on top of a hypervisor and not physical machine ? [For both Linux guests and Windows guests ]

/Jd

#1 lore raw
Quoted 6 lines · jd

Hi

Is there a way to detect if a particular machine is a VM running on KVM hypervisor or not. i.e from within a guest can one figure out if it is running on top of a hypervisor and not physical machine ? [For both Linux guests and Windows guests ]

You can generally infer the presence of qemu hosting based on the device name for certain devices. On a Linux guest for example:

# hwinfo --all | grep -i qemu

AFAIK, it can't tell you if it is a kvm accelerated guest though.

FWIW, it isn't really an interface to qemu or kvm so you probably can't guarantee it will continue to work or that the device strings can't be masked by something else on the host or guest. The same method is often suggested as a cheap (sleazy) way of detecting VMware hosting.

Signature · 1 line
David.
#2 lore raw
In reply to jd
Quoted 4 lines · jd

Hi

Is there a way to detect if a particular machine is a VM running on KVM hypervisor or not. i.e from within a guest can one figure out if it is running on top of a hypervisor and not physical machine ? [For both Linux guests and Windows guests ]

The preferred way of doing this is checking CPUID leaf 0x4000 0000 for the signature "KVMKVMKVM".

Most hypervisors (KVM, Xen, VMware, and Hyper-V) are adopting this as the preferred detection mechanism.

Regards,

Anthony Liguori

Quoted 10 lines

/Jd

--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#3 lore raw

Thanks. Good to know that most hypervisors are using this mechanism.

/Jd

Quoted 46 lines · Anthony Liguori

From: Anthony Liguori <[email protected]>
Subject: Re: KVM Guest detection
To: [email protected]
Cc: "KVM List" <[email protected]>
Date: Wednesday, August 13, 2008, 11:59 AM

Quoted 3 lines · jd

Hi

Is there a way to detect if a particular machine is a

VM running on KVM hypervisor or not. i.e from within a guest can one figure out if it is running on top of a hypervisor and not physical machine ? [For both Linux guests and Windows guests ]

Quoted 1 line

The preferred way of doing this is checking CPUID leaf 0x4000 0000 for
the signature "KVMKVMKVM".

Most hypervisors (KVM, Xen, VMware, and Hyper-V) are adopting this as
the preferred detection mechanism.

Regards,

Anthony Liguori

Quoted 7 lines

/Jd

--
To unsubscribe from this list: send the line

"unsubscribe kvm" in

Quoted 2 lines

the body of a message to [email protected] More majordomo info at

http://vger.kernel.org/majordomo-info.html

Quoted 1 line

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected] More majordomo info at
http://vger.kernel.org/majordomo-info.html