Why does OpenStack report Hypervisor type as QEMU when libvirt_type is KVM?

Updated on September 8, 2017

I installed OpenStack Mitaka and was curious to check various features in horizon dashboard. For instance, the System > Hypervisors menu in the dashboard provides summary of various compute hosts, its hypervisor type and usage details – where I was surprised to see Hypervisor type reported as QEMU and not KVM, though the compute nodes were configured to use KVM. The same hypervisor type was reported while using nova hypervisor-show <compute_host_id> |grep hypervisor_type command as well.

# nova hypervisor-show 1 |grep hypervisor_type
| hypervisor_type | QEMU

The nova.conf file is configured to use  libvirt_type=kvm

[libvirt]
libvirt_type=kvm
compute_driver=libvirt.LibvirtDriver

I googled this issue and understood that OpenStack client command uses libvirt connection type to determine hypervisor type instead of using libvirt_type attribute in nova.conf. Here’s a detailed report on this bug.

However, I wanted to know if the instances are started on KVM hypervisor instead of QEMU. Fortunately, there are few ways to do this.

openstack hypervisor type not kvm

I executed all these commands on the compute node.

Check if KVM modules are loaded

[compute_node]# lsmod |grep kvm
kvm_intel 172032 9
kvm 536576 1 kvm_intel
irqbypass 16384 7 kvm

Check if /dev/kvm exists

[compute_node]# ls -l /dev/kvm
crw-rw---- 1 root kvm 10, 232 Jun 14 11:01 /dev/kvm

Check if /dev/kvm is accessible to QEMU

[compute_node]# virt-host-validate |grep kvm
 QEMU: Checking if device /dev/kvm exists : PASS
 QEMU: Checking if device /dev/kvm is accessible

The above output means that, QEMU might be using KVM accelerator.

Check if KVM accelerator is used by QEMU

[compute_node]# ps -aef|grep kvm

Sample output:

/usr/bin/qemu-system-x86_64  -name instance-00000021 -S  -machine pc-i440fx-wily,accel=kvm,usb=off -cpu Nehalem

In the above output, you can see process qemu-system-x86_64 using accelerator kvm. According to this page, if your compute node runs qemu process with KVM accelerator, then the hypervisor is QEMU with KVM.

Check libvirt.xml of an instance

[compute_node]# cd /var/lib/nova/instances/<instance_id>
[compute_node]# cd /var/lib/nova/instances/b127f332-c631-4bd0-bde0-e90626d8bc27
[compute_node]# grep type libvirt.xml
<domain type="kvm">
<nova:root type="image" uuid="2cfff576-95e8-45cf-814a-63b695cb32e5"/>
<sysinfo type="smbios">
<type>hvm</type>
<disk type="file" device="disk">
<driver name="qemu" type="qcow2" cache="none"/>
<interface type="bridge">
<model type="virtio"/>
<serial type="file">
<serial type="pty"/>
<input type="tablet" bus="usb"/>
<graphics type="vnc" autoport="yes" keymap="en-us" listen="0.0.0.0"/>
<model type="cirrus"/>

In the libvirt.xml file lookout for type=kvm and driver=qemu, which means that the hypervisor is QEMU with KVM.

Check console.log of instance

[compute_node]# cd /var/lib/nova/instances/<instance_id>
[compute_node]# cd /var/lib/nova/instances/b127f332-c631-4bd0-bde0-e90626d8bc27
[compute_node]# grep KVM console.log
[ 0.000000] Booting paravirtualized kernel on KVM
[ 0.000000] KVM setup async PF for cpu 0

Dump instance xml to verify hypervisor type

Launch virsh as shown below:

# virsh

List the instances:

virsh # list
 Id Name State
 ----------------------------------------------------
 4 instance-00000021 running
 5 instance-00000023 running
 6 instance-00000024 running

Copy the id of one the instance – say ‘instance-00000021’ and dump its xml as shown below:

virsh # quit

Dump xml of an instance:

# virsh dumpxml instance-00000021 | grep kvm
 <domain type='kvm' id='4'>
# virsh dumpxml instance-00000021 | grep driver
 <driver name='qemu' type='qcow2' cache='none'/>
# virsh dumpxml instance-00000021 | grep emulator
 <emulator>/usr/bin/qemu-system-x86_64</emulator>

The above outputs confirms that QEMU is using KVM accelerator.

Bonus…

You can also login to any of the instance and perform few virtualization detection techniques to identify the underlying hypervisor type as shown here.

Conclusion

Although OpenStack dashboard and client commands report hypervisor type as QEMU, it’s actually QEMU with KVM accelerator and not just QEMU (which is just a software emulator). So the conclusion is, it might be a bug in OpenStack that reports hypervisor type as QEMU when QEMU with KVM is enabled or it’s just the way OpenStack reports. Few forums argue that it’s a bug in OpenStack documentation that failed to clearly mention the type of hypervisor supported (although I see a page listing the type of hypervisors supported in OpenStack, it lacks in providing the difference between QEMU and KVM).

Was this article helpful?

Related Articles

Comments Leave a Comment

  1. It is November 2021 now, and this article is still valid reference to check whether the hypervisor is Qemu with KVM accelerator or just QEMU.

Leave a Comment