Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

2.17. kvm

Kernel-based Virtual Machine (KVM) is a full virtualization solution for Linux on x86 hardware.
KVM is a Linux kernel module built for the standard Red Hat Enterprise Linux kernel. KVM can run multiple unmodified, virtualized guest Windows and Linux operating systems. KVM is a hypervisor which uses the libvirt virtualization tools (virt-manager and virsh).
  • Erroneous boot-index of a guest with mixed virtio/IDE disks causes the guest to boot from the wrong disk after the OS installation and hang with the error message boot from HD.
  • When using PCI device assignment with a 32-bit Microsoft Windows 2008 guest on an AMD-based host system, the assigned device may fail to work properly if it relies on MSI or MSI-X based interrupts. The reason for this is that the 32-bit version of Microsoft Windows 2008 does not enable MSI based interrupts for the family of processor exposed to the guest. To work around this problem, the user may wish to move to a RHEL6 host, use a 64-bit version of the guest operating system, or employ a wrapper script to modify the processor family exposed to the guest as follows (Note that this is only for 32-bit Windows guests):
    1. Create the following wrapper script:
      ~]$ cat /usr/libexec/qemu-kvm.family16
      #!/bin/sh
      
      ARGS=$@
      
      echo $ARGS | grep -q ' -cpu '
      if [ $? -eq 0 ]; then
          for model in $(/usr/libexec/qemu-kvm -cpu ? \
                         | sed 's|^x86||g' | tr -d [:blank:]); do
              ARGS=$(echo $ARGS | \
                     sed "s|-cpu $model|-cpu $model,family=16|g")
          done
      else
          ARGS="$ARGS -cpu qemu64,family=16"
      fi
      
      echo "$0: exec /usr/libexec/qemu-kvm $ARGS" >&2
      
      exec /usr/libexec/qemu-kvm $ARGS
      
    2. Make the script executable:
      ~]$ chmod 755 /usr/libexec/qemu-kvm.family16
    3. Set proper SELinux permissions:
      ~]$ restorecon /usr/libexec/qemu-kvm.family16
    4. Update the guest XML to use the new wrapper:
      ~]# virsh edit $GUEST
      and replace:
      <emulator>/usr/libexec/qemu-kvm</emulator>
      
      with:
      <emulator>/usr/libexec/qemu-kvm.family16</emulator>
      
    (BZ#654208)
  • Booting a Linux guest causes 1.5 to 2 second time drift from the host time when the default hwclock service starts. It is recommended to disable the hwclock service. Alternatively, enable the ntp service so that it can correct the time once the service is started. (BZ#523478)
  • By default, KVM virtual machines created in Red Hat Enterprise Linux 5.6 have a virtual Realtek 8139 (rtl8139) network interface controller (NIC). The rtl8139 virtual NIC works fine in most environments, but may suffer from performance degradation issues on some networks for example, a 10 GigE (10 Gigabit Ethernet) network.
    One workaround for this issue is switch to a different type of virtual NIC, for example, Intel PRO/1000 (e1000) or virtio (a virtual I/O driver for Linux that can talk to the hypervisor).
    To switch to e1000:
    1. Shutdown the guest OS
    2. Edit the guest OS definition with the command-line tool virsh:
      virsh edit GUEST
    3. Locate the network interface section and add a model line as shown:
      <interface type='network'>
      ...
      <model type='e1000' />
      </interface>
      
    4. Save the changes and exit the text editor
    5. Restart the guest OS
    Alternatively, if you're having trouble installing the OS on the virtual machine because of the rtl8139 NIC (for example, because you're installing the OS over the network), you can create a virtual machine from scratch with an e1000 NIC. This method requires you to have at least one virtual machine already created (possibly installed from CD or DVD) to use as a template.
    1. Create an XML template from an existing virtual machine:
      virsh dumpxml GUEST > /tmp/guest.xml
    2. Copy and edit the XML file and update the unique fields: virtual machine name, UUID, disk image, MAC address, etc. Note that you can delete the UUID and MAC address lines and virsh will generate a UUID and MAC address.
      cp /tmp/guest.xml /tmp/new-guest.xml
      vi /tmp/new-guest.xml
    3. Locate the network interface section and add a model line as shown:
      <interface type='network'>
      ...
      <model type='e1000' />
      </interface>
      
    4. Create the new virtual machine:
      virsh define /tmp/new-guest.xml 
      virsh start new-guest
  • The mute button in the audio control panel on a Windows virtual machine does not mute the sound.
  • When migrating KVM guests between hosts, the NX CPU feature setting on both source and destination must match. Migrating a guest between a host with the NX feature disabled (i.e. disabled in the BIOS settings) and a host with the NX feature enabled may cause the guest to crash. (BZ#516029)
  • The use of the qcow2 disk image format with KVM is considered a Technology Preview. (BZ#517880)
  • 64-bit versions of Windows 7 do not have support for the AC'97 Audio Codec. Consequently, the virtualized sound device Windows 7 kvm guests will not function. (BZ#563122)
  • Hot plugging emulated devices after migration may result in the virtual machine crashing after a reboot or the devices no longer being visible. (BZ#507191)
  • The KVM modules from the kmod-kvm package do not support kernels prior to version 2.6.18-203.el5. If kmod-kvm is updated and an older kernel is kept installed, error messages similar to the following will be returned if attempting to install these modules on older kernels:
    WARNING: /lib/modules/2.6.18-194.el5/weak-updates/kmod-kvm/ksm.ko needs unknown symbol kvm_ksm_spte_count
    
    (BZ#509361)
  • The KVM modules available in the kmod-kvm package are loaded automatically at boot time if the kmod-kvm package is installed. To make these KVM modules available after installing the kmod-kvm package the system either needs to be rebooted or the modules can be loaded manually by running the /etc/sysconfig/modules/kvm.modules script. (BZ#501543)
  • The Preboot eXecution Environment (PXE) boot ROMs included with KVM are from the Etherboot project. Consequently, some bug fixes or features that are present on the newer gPXE project are not available on Etherboot. For example, Virtual Machines (VMs) cannot boot using Microsoft based PXE (that is, Remote Installation Services (RIS) or Windows Deployment Services (WDS)).
  • The following QEMU / KVM features are currently disabled and not supported: (BZ#512837)
    • smb user directories
    • scsi emulation
    • "isapc" machine type
    • nested KVM guests
    • usb mass storage device emulation
    • usb wacom tablet emulation
    • usb serial emulation
    • usb network emulation
    • usb bluetooth emulation
    • device emulation for vmware drivers
    • sb16 and es1370 sound card emulations
    • bluetooth emulation
    • qemu CPU models other than qemu32/64 and pentium3
    • qemu block device drivers other than raw, qcow2, and host_device