KVM

KVM is configured as the default hypervisor for Compute. To enable KVM explicitly, add the following configuration options /etc/nova/nova.conf:

connection_type=libvirt
libvirt_type=kvm

The KVM hypervisor supports the following virtual machine image formats:

  • Raw

  • QEMU Copy-on-write (qcow2)

  • VMWare virtual machine disk format (vmdk)

The rest of this section describes how to enable KVM on your system. You may also wish to consult distribution-specific documentation:

 Checking for hardware virtualization support

The processors of your compute host need to support virtualization technology (VT) to use KVM.

If you are running on Ubuntu, use the kvm-ok command to check if your processor has VT support, it is enabled in the BIOS, and KVM is installed properly, as root:

# kvm-ok

If KVM is enabled, the output should look something like:

INFO: /dev/kvm exists
KVM acceleration can be used

If KVM is not enabled, the output should look something like:

INFO: Your CPU does not support KVM extensions
KVM acceleration can NOT be used

In the case that KVM acceleration is not supported, Compute should be configured to use a different hypervisor, such as QEMU or Xen.

On distributions that don't have kvm-ok, you can check if your processor has VT support by looking at the processor flags in the /proc/cpuinfo file. For Intel processors, look for the vmx flag, and for AMD processors, look for the svm flag. A simple way to check is to run the following command and see if there is any output:

$ egrep '(vmx|svm)' --color=always /proc/cpuinfo

Some systems require that you enable VT support in the system BIOS. If you believe your processor supports hardware acceleration but the above command produced no output, you may need to reboot your machine, enter the system BIOS, and enable the VT option.

 Enabling KVM

KVM requires the kvm and either kvm-intel or kvm-amd modules to be loaded. This may have been configured automatically on your distribution when KVM is installed.

You can check that they have been loaded using lsmod, as follows, with expected output for Intel-based processors:

$ lsmod | grep kvm
kvm_intel             137721  9
kvm                   415459  1 kvm_intel

The following sections describe how to load the kernel modules for Intel-based and AMD-based processors if they were not loaded automatically by your distribution's KVM installation process.

 Intel-based processors

If your compute host is Intel-based, run the following as root to load the kernel modules:

# modprobe kvm
# modprobe kvm-intel

Add the following lines to /etc/modules so that these modules will load on reboot:

kvm
kvm-intel

 AMD-based processors

If your compute host is AMD-based, run the following as root to load the kernel modules:

# modprobe kvm
# modprobe kvm-amd

Add the following lines to /etc/modules so that these modules will load on reboot:

kvm
kvm-amd

 Troubleshooting

Trying to launch a new virtual machine instance fails with the ERROR state, and the following error appears in /var/log/nova/nova-compute.log

libvirtError: internal error no supported architecture for os type 'hvm'

This is a symptom that the KVM kernel modules have not been loaded.



loading table of contents...