Rawpixel - Fotolia


The diminishing role of QEMU in KVM virtualization

QEMU has been an integral part of KVM virtualization for years, but its influence is slowly dwindling.

Before virtualization existed, emulation provided the ability to logically partition hardware. However, in emulated computer systems, CPUs are emulated through dynamic binary translation, which is a relatively inefficient approach when compared to virtualization. Today's modern hypervisors no longer have to translate instructions, which makes computing more efficient.

Virtualization is more efficient than emulation, because the CPU can process system calls directly. Therefore, in a modern virtualization platform, such as Kernel-based Virtual Machine (KVM), you might assume there is no need for techniques that are based on emulation. The contrary is true, and in this article, we'll explore the current role of QEMU (short for Quick Emulator), an open source emulator, in a KVM-virtualized environment.

To understand how QEMU and KVM work together, we first need to explore how QEMU has developed in recent years. QEMU was first created a long time ago, but it is still actively developed, and has evolved into a hypervisor. The last stable release is 2.0, which was launched in April 2014. It supports Linux and Windows, as well as some other UNIX virtual machine types.

Modern distributions that are using KVM don't implement a full QEMU approach. However, they do integrate some of the tools that come from the QEMU project. This approach is typical among open source software; why bother creating new code if a working solution already exists in the open source domain?

The QEMU approach to managing disks

An important command that originates from QEMU is QEMU-img, a tool that allows you to create, convert and modify disk images. This tool is extremely versatile in managing different disk formats. QEMU-img goes way beyond creating disks in qcow (the QEMU copy-on-write format), or qcow2, the version of the copy-on-write format that includes new advanced features. It also supports other formats, such as the raw disk format, VMware's VMDK format, and the .vdi format for working with VirtualBox disk images.

When using a default KVM management tool, such as virt-install or Virtual Machine Manager, you'll be able to create the storage back end that will be used by your virtual machine (VM). Behind the scenes, the interface you're using is often relying on QEMU-img. The command executed in the back end may look something like: QEMU-img create -f qcow2 windows.img 10G. This example would create a 10 GB file in qcow2 format with the name windows.img.

QEMU hardware drivers

In addition to a disk format and a versatile role that permits administrators to manipulate the storage back end of a VM, QEMU also offers many drivers for hardware. On a modern KVM distribution, like Red Hat Enterprise Linux 7, these drivers are in the QEMU-kvm-tools package, and include drivers for the virtualized hardware used on top of the KVM kernel modules in Red Hat. In KVM, you can use VirtIO as an alternative to the QEMU emulation approach, which decreases the need to use these emulated drivers.

QEMU slowly being replaced

When KVM was first made available in Linux, it consisted of just a few kernel modules, and all upper-layer functionality was provided through other utilities. For that reason, QEMU played a more significant role in older versions of KVM and offered functionality needed to access hardware. Recently, KVM has seen its own improvements, like the introduction of the VirtIO drivers that allow VMs to address hardware much more efficiently than the traditional QEMU approach. Surely, new developments will follow in KVM, making QEMU less important. However, KVM developers continue to work together with QEMU developers, thus providing a well-integrated set of kernel modules, tools and drivers to provide versatile virtualization on Linux.

Dig Deeper on Open source virtualization