The Puppet Labs Issue Tracker has Moved:

This issue tracker is now in read-only archive mode and automatic ticket export has been disabled. Redmine users will need to create a new JIRA account to file tickets using See the following page for information on filing tickets with JIRA:

Feature #2755

virtual.rb should detect KVM guests.

Added by David Pashley over 6 years ago. Updated about 6 years ago.

Status:ClosedStart date:10/26/2009
Priority:NormalDue date:
Assignee:Paul Nasrat% Done:


Target version:1.5.8
Keywords: Affected Facter version:

We've Moved!

Ticket tracking is now hosted in JIRA:


The virtual fact currently doesnt detect KVM instances.

Here’s some debugging on a Ubuntu guest.

lspci output:

00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
00:01.2 USB Controller: Intel Corporation 82371SB PIIX3 USB [Natoma/Triton II] (rev 01)
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
00:02.0 VGA compatible controller: Cirrus Logic GD 5446
00:03.0 Ethernet controller: Qumranet, Inc. Virtio network device
00:04.0 Multimedia audio controller: Ensoniq ES1370 [AudioPCI]
00:05.0 SCSI storage controller: Qumranet, Inc. Virtio block device
00:06.0 RAM memory: Qumranet, Inc. Virtio memory balloon


processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model       : 2
model name  : QEMU Virtual CPU version 0.11.0
stepping    : 3
cpu MHz     : 12666.936
cache size  : 2048 KB
fpu     : yes
fpu_exception   : yes
cpuid level : 2
wp      : yes
flags       : fpu de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx lm up rep_good pni hypervisor
bogomips    : 6333.46
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management:


# dmidecode 2.9
SMBIOS 2.4 present.
10 structures occupying 239 bytes.
Table at 0x000FBCBF.

Handle 0x0000, DMI type 0, 24 bytes
BIOS Information
    Vendor: QEMU
    Version: QEMU
    Release Date: 01/01/2007
    Address: 0xE8000
    Runtime Size: 96 kB
    ROM Size: 64 kB
        BIOS characteristics not supported
    BIOS Revision: 1.0

Handle 0x0100, DMI type 1, 27 bytes
System Information
    Manufacturer: Not Specified
    Product Name: Not Specified
    Version: Not Specified
    Serial Number: Not Specified
    UUID: DDB2139D-4E4B-EB2E-4776-A5B13AB397E8
    Wake-up Type: Power Switch
    SKU Number: Not Specified
    Family: Not Specified

Handle 0x0300, DMI type 3, 20 bytes
Chassis Information
    Manufacturer: Not Specified
    Type: Other
    Lock: Not Present
    Version: Not Specified
    Serial Number: Not Specified
    Asset Tag: Not Specified
    Boot-up State: Safe
    Power Supply State: Safe
    Thermal State: Safe
    Security Status: Unknown
    OEM Information: 0x00000000

Handle 0x0401, DMI type 4, 32 bytes
Processor Information
    Socket Designation: CPU 1
    Type: Central Processor
    Family: Other
    Manufacturer: Not Specified
    ID: 23 06 00 00 FD FB 8B 07
    Version: Not Specified
    Voltage: Unknown
    External Clock: Unknown
    Max Speed: Unknown
    Current Speed: Unknown
    Status: Populated, Enabled
    Upgrade: Other
    L1 Cache Handle: Not Provided
    L2 Cache Handle: Not Provided
    L3 Cache Handle: Not Provided

Handle 0x1000, DMI type 16, 15 bytes
Physical Memory Array
    Location: Other
    Use: System Memory
    Error Correction Type: Other
    Maximum Capacity: 512 MB
    Error Information Handle: Not Provided
    Number Of Devices: 1

Handle 0x1100, DMI type 17, 21 bytes
Memory Device
    Array Handle: 0x1000
    Error Information Handle: 0x0000
    Total Width: 64 bits
    Data Width: 64 bits
    Size: 512 MB
    Form Factor: DIMM
    Set: None
    Locator: DIMM 0
    Bank Locator: Not Specified
    Type: RAM
    Type Detail: None

Handle 0x1300, DMI type 19, 15 bytes
Memory Array Mapped Address
    Starting Address: 0x00000000000
    Ending Address: 0x0001FFFFFFF
    Range Size: 512 MB
    Physical Array Handle: 0x1000
    Partition Width: 0

Handle 0x1400, DMI type 20, 19 bytes
Memory Device Mapped Address
    Starting Address: 0x00000000000
    Ending Address: 0x0001FFFFFFF
    Range Size: 512 MB
    Physical Device Handle: 0x1100
    Memory Array Mapped Address Handle: 0x1300
    Partition Row Position: 1

Handle 0x2000, DMI type 32, 11 bytes
System Boot Information
    Status: No errors detected

Handle 0x7F00, DMI type 127, 4 bytes
End Of Table

Related issues

Related to Facter - Bug #2747: the virtual fact and xen Closed 10/22/2009
Related to Facter - Bug #2865: facter 1.5.7 changed the report of the virtual fact Closed 11/26/2009


#1 Updated by James Turnbull over 6 years ago

diff --git a/lib/facter/virtual.rb b/lib/facter/virtual.rb
index fdb340f..4f68629 100644
--- a/lib/facter/virtual.rb
+++ b/lib/facter/virtual.rb
@@ -70,6 +70,11 @@ Facter.add("virtual") do
             result = "vserver_host"
+        if FileTest.exists?('/proc/cpuinfo')
+            output = %x{egrep '^model name' /proc/cpuinfo}
+            result = "kvm_guest" if output.include?("QEMU")
+        end

#2 Updated by Jason White over 6 years ago

On a RHEL 4.6 (2.6.9-89.0.16.EL) KVM guest, the cpuinfo is quite different:

model name : 02/03

$ cat /proc/cpuinfo
processor   : 0
vendor_id   : AuthenticAMD
cpu family  : 6
model       : 3
model name  : 02/03
stepping    : 3
cpu MHz     : 2801.729
fdiv_bug    : no
hlt_bug     : no
f00f_bug    : no
coma_bug    : no
fpu     : yes
fpu_exception   : yes
cpuid level : 2
wp      : yes
flags       : fpu de pse tsc msr pae mce cx8 apic pge cmov pat mmx fxsr sse sse2 pni
bogomips    : 5633.17

The KVM host is RHEL 5.4, and the process looks like this:

/usr/libexec/qemu-kvm -S -M pc -cpu qemu32 -m 2048 -smp 1 -name myguest -uuid xxxx -monitor pty -pidfile /var/run/libvirt/qemu// -localtime -boot c -drive file=/dev/vg/myguest,if=ide,index=0,boot=on -net nic,macaddr=xxx,vlan=0 -net tap,fd=15,script=,vlan=0,ifname=vnet2 -serial pty -parallel none -usb -vnc -k en-us

However, a RHEL 5.4 guest shows QEMU, like the original poster mentioned:

model name : QEMU Virtual CPU version 0.9.1

#3 Updated by James Turnbull over 6 years ago

  • Category set to library
  • Status changed from Unreviewed to Accepted
  • Target version set to 1.6.0

#4 Updated by John Ferlito about 6 years ago

I’ve created a branch with a patch for this at

#5 Updated by Paul Nasrat about 6 years ago

  • Status changed from Accepted to In Topic Branch Pending Review
  • Assignee set to Paul Nasrat
  • Target version changed from 1.6.0 to 1.5.8

Thanks for the patch – looking over looks good, need to test and will merge hopefully this weekend.

#6 Updated by Paul Nasrat about 6 years ago

  • Status changed from In Topic Branch Pending Review to Ready For Checkin

Tested on KVM at work – thanks for the tests too!

#7 Updated by Paul Nasrat about 6 years ago

  • Status changed from Ready For Checkin to Closed

Commited & pushed

Also available in: Atom PDF