how to determine is system is KVN, Openvz or hardware?

bread-baker

Member
Mar 6, 2010
432
0
16
how to determine is system is KVM, Openvz or hardware?

for some scripts, we need to know the type of system.. we are concerned with linux systems only.

so what do I test for:

openvz : true if /proc/vz exits

kvm : true if ?

otherwise : hardware .

I have not been able to figure out how to tell if a system is kvm or hardware.

In case anyone knows, please reply.

thank you
 
Last edited:
Re: how to determine is system is KVM, Openvz or hardware?

for some scripts, we need to know the type of system.. we are concerned with linux systems only.

so what do I test for:

openvz : true if /proc/vz exits

kvm : true if ?

otherwise : hardware .

I have not been able to figure out how to tell if a system is kvm or hardware.

In case anyone knows, please reply.

thank you
Hi,
whats about
Code:
cat /proc/cpuinfo | grep "model name"
if the cpu is QEMU you have an kvm-machine.
But i don't know the output if you use "cpu=host"...

Udo
 
Re: how to determine is system is KVM, Openvz or hardware?

Are you sure there's no way fake out the CPU name and replace Qemu with something else?
 
Re: how to determine is system is KVM, Openvz or hardware?

Hi,
whats about
Code:
cat /proc/cpuinfo | grep "model name"
if the cpu is QEMU you have an kvm-machine.
But i don't know the output if you use "cpu=host"...

Udo

where / why would 'cpu=host' be used?

so far this works:
Code:
cat /proc/cpuinfo | grep "model name" | grep QEMU && KVM=Y ; echo $KVM