From the perspective of the Compute service, the QEMU hypervisor is very similar to the KVM hypervisor. Both are controlled through libvirt, both support the same feature set, and all virtual machine images that are compatible with KVM are also compatible with QEMU. The main difference is that QEMU does not support native virtualization. Consequently, QEMU has worse performance than KVM and is a poor choice for a production deployment.
The typical uses cases for QEMU are
Running on older hardware that lacks virtualization support.
Running the Compute service inside of a virtual machine for development or testing purposes, where the hypervisor does not support native virtualization for guests.
KVM requires hardware support for acceleration. If hardware support is not available (e.g., if you are running Compute inside of a VM and the hypervisor does not expose the required hardware support), you can use QEMU instead. KVM and QEMU have the same level of support in OpenStack, but KVM will provide better performance. To enable QEMU:
compute_driver=libvirt.LibvirtDriver libvirt_type=qemu
For some operations you may also have to install the guestmount utility:
$> sudo apt-get install guestmount
$> sudo yum install libguestfs-tools
The QEMU hypervisor supports the following virtual machine image formats:
Raw
QEMU Copy-on-write (qcow2)
VMWare virtual machine disk format (vmdk)
If you are testing OpenStack in a virtual machine, you need to configure nova to use qemu without KVM and hardware virtualization. The second command relaxes SELinux rules to allow this mode of operation (https://bugzilla.redhat.com/show_bug.cgi?id=753589) The last 2 commands here work around a libvirt issue fixed in RHEL 6.4. Note nested virtualization will be the much slower TCG variety, and you should provide lots of memory to the top level guest, as the OpenStack-created guests default to 2GM RAM with no overcommit.
Note | |
---|---|
The second command, setsebool, may take a while. |
$> sudo openstack-config --set /etc/nova/nova.conf DEFAULT libvirt_type qemu $> setsebool -P virt_use_execmem on $> sudo ln -s /usr/libexec/qemu-kvm /usr/bin/qemu-system-x86_64 $> sudo service libvirtd restart