Chapter 4. Introduction to Red Hat virtualization products
This chapter introduces the various virutalization products available in Red Hat Enterprise Linux.
4.1. KVM and virtualization in Red Hat Enterprise Linux
KVM (Kernel-based Virtual Machine) is a full virtualization solution for Linux on AMD64 and Intel 64 hardware that is built into the standard Red Hat Enterprise Linux 6 kernel. It can run multiple, unmodified virtualized guest Windows and Linux operating systems. The KVM hypervisor in Red Hat Enterprise Linux is managed with the libvirt API and tools built for libvirt (such as virt-manager
and virsh
). Virtualized guests are executed and run as multi-threaded Linux processes which are controlled by these tools.
The KVM hypervisor supports overcommitting of system resources. Overcommitting means allocating more virtualized CPUs or memory than the available resources on the system. Memory overcommitting allows hosts to utilize memory and virtual memory to increase guest densities.
A single guest can not use more CPU or memory than physically available. Overcommitting does, however, support the operation of multiple guests that have a total CPU and/or memory requirement greater than the physical host.
Overcommitting involves possible risks to system stability. For more information on overcommitting with KVM, and the precautions that should be taken, refer to the Red Hat Enterprise Linux 6 Virtualization Administration Guide.
Kernel SamePage Merging (KSM) is used by the KVM hypervisor to allow KVM guests to share identical memory pages. These shared pages are usually common libraries or other identical, high-use data. KSM allows for greater guest density of identical or similar guest operating systems by avoiding memory duplication.
For more information on KSM, refer to the Red Hat Enterprise Linux 6 Virtualization Administration Guide.
To verify whether your processor supports the virtualization extensions and for information on enabling the virtualization extensions if they are disabled, refer to the Red Hat Enterprise Linux Virtualization Administration Guide.
Red Hat Enterprise Linux 6 servers have certain support limits.
The following URLs explain the processor and memory amount limitations for Red Hat Enterprise Linux:
The following URL shows a complete chart of supported operating systems and host and guest combinations:
4.2. libvirt and the libvirt tools
Libvirt is a hypervisor-independent virtualization API that is able to interact with the virtualization capabilities of a range of operating systems.
Libvirt provides:
A common, generic and stable layer to securely manage virtualized guests on a host.
A common interface for managing local systems and networked hosts.
All of the APIs required to provision, create, modify, monitor, control, migrate and stop virtualized guests if the hypervisor supports these operations. Although multiple hosts may be accessed with libvirt simultaneously, the APIs are limited to single node operations.
Libvirt is designed as a building block for higher level management tools and applications, for example, virt-manager
and the virsh
command line management tools. Libvirt focuses on managing single hosts, with the exception of migration capabilities and provides APIs to enumerate, monitor and use the resources available on the managed node, including CPUs, memory, storage, networking and Non-Uniform Memory Access (NUMA) partitions. The management tools can be located on separate physical machines from the host using secure protocols.
Red Hat Enterprise Linux 6 supports libvirt and included libvirt-based tools as its default method for virtualization management.
Libvirt is available as free software under the GNU Lesser General Public License. The libvirt project aims to provide a long term stable C API to virtualization management tools, running on top of varying hypervisor technologies. The libvirt package supports Xen on Red Hat Enterprise Linux 5, and it supports KVM on both Red Hat Enterprise Linux 5 and Red Hat Enterprise Linux 6.
The virsh
command-line tool is built on the libvirt
management API and operates as an alternative to the graphical virt-manager
application. The virsh
command can be used in read-only mode by unprivileged users or, with root access, full administration functionality. The virsh
command is ideal for scripting virtualization administration.
The virsh
tool is included in the libvirt-client package.
virt-manager
is a graphical desktop tool for managing virtualized guests. It can be used to perform virtualization administration, virtualized guest creation, migration and configuration tasks and allows access to graphical guest consoles. The ability to view virtualized guests, host statistics, device information and performance graphs is also provided. The local hypervisor and remote hypervisors can be managed through a single interface.
For more information on virt-manager
, refer to the Red Hat Enterprise Linux 6 Virtualization Administration Guide.
4.3. Virtualized hardware devices
Virtualization on Red Hat Enterprise Linux 6 presents three distinct types of system devices to virtualized guests. The three types include:
Emulated software devices.
Para-virtualized devices.
Physically shared devices.
These hardware devices all appear as being physically attached to the virtualized guest but the device drivers work in different ways.
4.3.1. Virtualized and emulated devices
KVM implements many core devices for virtualized guests in software. These emulated hardware devices are crucial for virtualizing operating systems.
Emulated devices are virtual devices which exist entirely in software.
Emulated drivers may use either a physical device or a virtual software device. Emulated drivers are a translation layer between the guest and the Linux kernel (which manages the source device). The device level instructions are completely translated by the KVM hypervisor. Any device, of the same type (that is, storage, network, keyboard, and mouse) and recognized by the Linux kernel, may be used as the backing source device for the emulated drivers.
A host system has a number of virtual CPUs (vCPUs) that can be presented to guest operating systems for their use. The number of virtual CPUs that can be offered to guests is finite and is determined by the number of physical processor cores on the host.
Two emulated graphics devices are provided. These devices can be connected to with the SPICE protocol or with VNC:
A Cirrus CLGD 5446 PCI VGA card (using the cirrus device).
A standard VGA graphics card with Bochs VESA extensions (hardware level, including all non-standard modes).
The following core system components are emulated to provide basic system functions:
Intel i440FX host PCI bridge.
PIIX3 PCI to ISA bridge.
PS/2 mouse and keyboard.
EvTouch USB Graphics Tablet.
PCI UHCI USB controller and a virtualized USB hub.
PCI network adapters.
Emulated serial ports.
EHCI controller, virtualized USB storage and a USB mouse
Red Hat Enterprise Linux 6.1 and above provide an emulated (Intel) HDA sound device, intel-hda
. This device is supported on the following guest operating systems:
Red Hat Enterprise Linux 6, for i386 and x86_64 architectures.
Red Hat Enterprise Linux 5, for i386 and x86_64 architectures.
Red Hat Enterprise Linux 4, for i386 and x86_64 architectures.
Windows 2008 R2, for the x86_64 architecture.
Windows 7, for i386 and x86_64 architectures.
The following two emulated sound devices are also available but are not recommended due to compatibility issues with certain guests:
ac97
, an emulated Intel 82801AA AC97 Audio compatible sound card.
es1370
, an emulated ENSONIQ AudioPCI ES1370 sound card.
Red Hat Enterprise Linux 6.0 and above provides two emulated watchdog devices. A watchdog can be used to automatically reboot a guest when it becomes overloaded or unresponsive.
The watchdog devices are supported by the guest operating system Red Hat Enterprise Linux 6.2 and above, for i386 and x86_64 architectures.
You will need to install the watchdog
package in the guest.
The two devices are:
i6300esb
, an emulated Intel 6300 ESB PCI watchdog device. This is the recommended device to use.
ib700
, an emulated iBase 700 ISA watchdog device.
There are two emulated network drivers available for network devices:
The e1000
driver emulates an Intel E1000 network adapter (Intel 82540EM, 82573L, 82544GC).
The rtl8139
driver emulates a Realtek 8139 network adapter.
Storage devices and storage pools can use these emulated drivers to attach storage devices to virtualized guests.
Note that the storage drivers are not storage devices. The drivers are used to attach a backing storage device, file or storage pool volume to a virtualized guest. The backing storage device can be any supported type of storage device, file, or storage pool volume.
- The emulated IDE driver
KVM provides two emulated PCI IDE interfaces. An emulated IDE driver can be used to attach any combination of up to four virtualized IDE hard disks or virtualized IDE CD-ROM drives to each virtualized guest. Emulated IDE driver is also used for virtualized CD-ROM and DVD-ROM drives.
- The emulated floppy disk drive driver
The emulated floppy disk drive driver is used for creating virtualized floppy drives.
4.3.2. Para-virtualized drivers
Para-virtualized drivers are drivers for virtual devices that increase the I/O performance of virtualized guests.
Para-virtualized drivers decrease I/O latency and increase I/O throughput to near bare-metal levels. It is recommended to use the para-virtualized drivers for virtualized guests running I/O intensive applications.
The para-virtualized drivers must be installed on the guest operating system. By default, the para-virtualized drivers are included in Red Hat Enterprise Linux 4.7 and newer, Red Hat Enterprise Linux 5.4 and newer and Red Hat Enterprise Linux 6.0 and newer. The para-virtualized drivers must be manually installed on Windows guests.
For more information on using the para-virtualized drivers refer to the Red Hat Enterprise Linux 6 Virtualization Host Configuration and Guest Installation Guide.
The para-virtualized network driver is a Red Hat branded virtual network device. It can be used as the driver for existing network devices or new network devices for virtualized guests.
The para-virtualized block driver is a driver for all storage devices supported by the hypervisor attached to the virtualized guest (except for floppy disk drives, which must be emulated).
Guests using the Time Stamp Counter (TSC) as a clock source may suffer timing issues.
KVM works around hosts that do not have a constant Time Stamp Counter by providing guests with a para-virtualized clock.
The para-virtualized serial driver is a bytestream-oriented, character stream driver, and provides a simple communication interface between the host's user space and the guest's user space.
The balloon driver can designate part of the guest's RAM as not being in use (a process known as balloon inflation) so that the memory can be freed for the host (or for other guests on that host) to use. When the guest needs the memory again, the balloon can be deflated and the host can distribute the RAM back to the guest.
4.3.3. Physical host devices
Certain hardware platforms allow virtualized guests to directly access various hardware devices and components. This process in virtualization is known as device assignment. Device assignment is also known as passthrough.
The KVM hypervisor supports attaching PCI devices on the host system to virtualized guests. PCI device assignment allows guests to have exclusive access to PCI devices for a range of tasks. It allows PCI devices to appear and behave as if they were physically attached to the guest operating system.
Device assignment is supported on PCI Express devices, with the exception of graphics cards. Parallel PCI devices may be supported as assigned devices, but they have severe limitations due to security and system configuration conflicts.
For more information on Device assignment, refer to the Red Hat Enterprise Linux 6 Virtualization Host Configuration and Guest Installation Guide.
The KVM hypervisor supports attaching USB devices on the host system to virtualized guests. USB device assignment allows guests to have exclusive access to USB devices for a range of tasks. It allows USB devices to appear and behave as if they were physically attached to the guest operating system.
For more information on USB passthrough, refer to the Red Hat Enterprise Linux 6 Virtualization Administration Guide.
SR-IOV (Single Root I/O Virtualization) is a PCI Express standard that extends a single physical PCI function to share its PCI resources as separate, virtual functions (VFs). Each function is capable of being used by a different guest via PCI device assignment.
An SR-IOV capable PCI-e device provides a Single Root Function (for example, a single Ethernet port), and presents multiple, separate virtual devices as separate, unique PCI device functions, each with its own unique PCI configuration space, memory-mapped registers and separate (MSI-based) interrupts.
For more information on SR-IOV, refer to the Red Hat Enterprise Linux 6 Virtualization Host Configuration and Guest Installation Guide.
N_Port ID Virtualization (NPIV) is a function available with some Fibre Channel devices. NPIV shares a single physical N_Port as multiple N_Port IDs. NPIV provides similar functionality for Fibre Channel Host Bus Adaptors (HBAs) that SR-IOV provides for PCIe interfaces. With NPIV, virtualized guests can be provided with a virtual Fibre Channel initiator to Storage Area Networks (SANs).
NPIV can provide high density virtualized environments with enterprise-level storage solutions.
For more information on NPIV, refer to the Red Hat Enterprise Linux 6 Virtualization Administration Guide.
Historically, CPU model definitions were hard-coded in qemu. This method of defining CPU models was inflexible, and made it difficult to create virtual CPUs with feature sets that matched existing physical CPUs. Typically, users modified a basic CPU model definition with feature flags in order to provide the CPU characteristics required by a guest. Unless these feature sets were carefully controlled, safe migration — which requires feature sets between current and prospective hosts to match — was difficult to support.
qemu-kvm has now replaced most hard-wired definitions with configuration file based CPU model definitions. Definitions for a number of current processor models are now included by default, allowing users to specify features more accurately and migrate more safely.
A list of supported CPU models can be viewed with the /usr/libexec/qemu-kvm -cpu ?model
command. This command outputs the name
used to select the CPU model at the command line, and a model identifier that corresponds to a commercial instance of that processor class. The CPU models that Red Hat Enterprise Linux supports can be found in the qemu-kvm Whitelist chapter in the Virtualization Administration Guide.
Configuration details for all of these CPU models can be output with the /usr/libexec/qemu-kvm -cpu ?dump
command, but they are also stored in the /usr/share/qemu-kvm/cpu-model
/cpu-x86_64.conf
file by default. Each CPU model definition begins with [cpudef]
, like so:
[cpudef]
name = "Nehalem"
level = "2"
vendor = "GenuineIntel"
family = "6"
model = "2"
stepping = "3"
feature_edx = "sse2 sse fxsr mmx pat cmov pge sep apic cx8 mce \
pae msr tsc pse de fpu mtrr clflush mca pse36"
feature_ecx = "sse3 ssse3"
extfeature_edx = "fxsr mmx pat cmov pge apic cx8 mce pae msr \
tsc pse de fpu lm syscall nx"
extfeature_ecx = "lahf_lm"
xlevel = "0x8000000A"
model_id = "Intel Celeron_4x0 (Nehalem/Merom Class Core 2)"
The four CPUID fields, feature_edx
, feature_ecx
, extfeature_edx
and extfeature_ecx
, accept named flag values from the corresponding feature sets listed by the /usr/libexec/qemu-kvm -cpu ?cpuid
command:
# qemu-kvm -cpu ?cpuid
Recognized CPUID flags:
f_edx: pbe ia64 tm ht ss sse2 sse fxsr mmx acpi ds clflush pn \
pse36 pat cmov mca pge mtrr sep apic cx8 mce pae msr tsc \
pse de vme fpu
f_ecx: hypervisor avx osxsave xsave aes popcnt movbe x2apic \
sse4.2|sse4_2 sse4.1|sse4_1 dca pdcm xtpr cx16 fma cid \
ssse3 tm2 est smx vmx ds_cpl monitor dtes64 pclmuldq \
pni|sse3
extf_edx: 3dnow 3dnowext lm rdtscp pdpe1gb fxsr_opt fxsr mmx \
mmxext nx pse36 pat cmov mca pge mtrr syscall apic cx8 \
mce pae msr tsc pse de vme fpu
extf_ecx: nodeid_msr cvt16 fma4 wdt skinit xop ibs osvw \
3dnowprefetch misalignsse sse4a abm cr8legacy extapic svm \
cmp_legacy lahf_lm
These feature sets are described in greater detail in the appropriate Intel and AMD specifications.
It is important to use the check
flag to verify that all configured features are available.
# /usr/libexec/qemu-kvm -cpu Nehalem,check
warning: host cpuid 0000_0001 lacks requested flag 'sse4.2|sse4_2' [0x00100000]
warning: host cpuid 0000_0001 lacks requested flag 'popcnt' [0x00800000]
If a defined feature is not available, those features will fail silently by default.