Chapter 37. Virtualization with Xen

Table of Contents

37.1. Xen Installation
37.2. Domain Installation
37.3. Configuring a Xen Guest Domain
37.4. Starting and Controlling Xen Domains
37.5. For More Information

Abstract

Xen makes it possible to run several Linux systems on one physical machine. The hardware for the different systems is provided virtually. This chapter gives an overview of the possibilities and limitations of this technology. Sections about installing, configuring, and running Xen complete this introduction.

Virtual machines commonly need to emulate the hardware a system needs. The disadvantage is that the emulated hardware is much slower than the real silicon. Xen has a different approach. It restricts emulation to as few parts as possible. To achieve this, Xen uses paravirtualization. This is a technique that presents virtual machines similarly, but not identically to the underlying hardware. Therefore, host and guest operating systems are adapted on kernel level. The user space remains unchanged. Xen controls the hardware with a hypervisor and a controlling guest, also called domain-0. These provide all needed virtualized block and network devices. The guest systems use these virtual block and network devices to run the system and connect to other guests or the local network. When several physical machines running Xen are configured in a way that the virtual block and network devices are available, it is also possible to migrate a guest system from one piece of hardware to another while running. Originally, Xen was developed to run up to 100 guest systems on one computer, but this number depends strongly on the system requirements of the running guest systems, especially the memory consumption.

To limit the CPU utilization, the Xen hypervisor offers three different schedulers. The scheduler also may be changed while running the guest system, making it is possible to change the priority of the running guest system. On a higher level, migrating a guest may also be used to adjust the available CPU power.

The Xen virtualization system also has some drawbacks regarding the supported hardware:

Figure 37.1. Xen Overview

Xen Overview

37.1. Xen Installation

The installation procedure of Xen involves the setup of a domain-0 domain and the installation of Xen clients. First, make sure that the needed packages are installed. These are python, bridge-utils, xen, and a kernel-xen package. When using SUSE packages, Xen is added to the GRUB configuration. For other cases, make an entry in boot/grub/menu.lst. This entry should be similar to the following:

title Xen2
    kernel (hd0,0)/boot/xen.gz dom0_mem=458752
    module (hd0,0)/boot/vmlinuz-xen <parameters>
    module (hd0,0)/boot/initrd-xen

Replace (hd0,0) with the partition that holds your /boot directory. See also Chapter 29, The Boot Loader. Alter the amount of dom0_mem to match your system. The maximum value is your system memory in kB minus 65536. Replace <parameters> with the parameters normally used to boot a Linux kernel. Then reboot into Xen mode. This boots the Xen hypervisor and a slightly changed Linux kernel as Domain-0 that runs most of the hardware. Apart from the exceptions already mentioned, everything should work as normal.