Sunday, September 18, 2011

Xen - Using NFS Root

The root file system is the file system that is directly mounted by the kernel during the boot phase and that holds the system initialization scripts and the most essential system programs. More specifically, the root file system includes the root directory together with a minimal set of subdirectories and files including ‘/boot’, ‘/dev’, ‘/etc’, ‘/bin’, ‘/sbin’ and sometimes ‘/tmp’.
Mounting the root file system is a crucial part of system initialization. The Linux kernel allows the root file system to be stored in many different places [4], such as a hard disk partition, a floppy disk, a ramdisk or a remote file system shared via NFS. In any case, the root file system can be specified as a device file in the ‘/dev’ directory either when compiling the kernel or by passing a suitable ‘root=’ option to the initial bootstrap loader. The root file system is mounted in a two-stage procedure:

  1. The kernel mounts the special ‘rootfs’ file system, which provides an empty directory.
  2. The kernel mounts the real root file system over this empty directory.

The root file system of a domU guest can be stored on a disk image in dom0, on a physical disk partition or in a directory hierarchy on dom0 or on a remote system which can be exported to the client via NFS. In this section we follow the last approach. More specifically, the root file system for the domU guest will be located on an exported directory hierarchy stored in a NFS server. This server could be dom0 guest, a remote machine or even another domU guest. Our goal is the domU client to mount this exported directory hierarchy as its root file system via NFS.

Xen - Management tools

Here we will see the basic management tools that Xen provides. These tools are not part of the hypervisor. Instead they lie in Domain0 and they can communicate with the Xen hypervisor through Xen API which is built atop XML-RPC. The user can manage all the virtual machines with these tools from Domain0 thus the dom0 guest is mentioned as “Xen management domain”.


Tuesday, September 13, 2011

Xen - Creating an HVM domU guest

Xen supports fully virtualized guest domains by using hardware assisted virtualization. Currently processors featuring the Intel Virtualization Technology (Intel-VT) or the AMD Virtualization Technology (AMD-V) are supported. For a way to see if your processor has virtualization technology run the following command if xend is running:

root@dom0$ xm dmesg | grep -i hvm

Saturday, September 10, 2011

Xen - Networking Configuration

In this article we will take a look at networking in Xen. Each domain network interface is connected to a virtual network interface in dom0 by a point to point link. These devices are named vif<domain id><interface id> (e.g. ‘vif1.0’ for the first interface ‘eth0’ in domain 1).
Traffic on these virtual interfaces is handled in dom0 using standard Linux mechanisms for bridging, routing with NAT or two-way routing. Typically, only one of these mechanisms can be used at one time. These mechanisms are defined in shell scripts under the directory ‘/etc/xen/scripts/’ and can be used by xend to perform initial configuration of the network and configuration of new virtual interfaces. The default mechanism that is used by xend is bridging. You can change this by commenting out the bridging scripts and enabling your preferred mechanism’s scripts in the file ‘/etc/xen/xend-config.sxp’. Each mechanism has two related scripts as shown below:
  • Bridge Networking: (network-script network-bridge), (vif-script vif-bridge).
  • Routed Networking with NAT: (network-script network-nat), (vif-script vif-nat).
  • Two-way Routed Networking: (network-script network-route), (vif-script vif-route).

Xen - Creating a PV domU guest

In this article we will explain how to create a new Xen unprivileged guest (domU). A Xen guest can be one of the following two types:
  • HVM Guest – Fully virtualized guest by using hardware assisted virtualization. The guest’s kernel needs no modifications but our CPU must include virtualization technology to support hardware assisted virtualization.
  • PV Guest – Paravirtualized guest. The guest’s kernel needs some modifications.
The first thing to do when creating a domU Linux guest is to decide what kernel we will use. On the one hand, we can use the existing dom0 kernel. However, because the dom0 kernel is full of unwanted stuff for a guest, like backend drivers we can build a new lightweight kernel for a domU guest. The next step after deciding what kernel to use is to create and configure the root file system for our domU guest. The guest’s root file system can reside in a file which acts as a virtual disk, in a physical partition or even in a remote NFS server. Finally, the last step is to create a configuration file to inform Xen about our new guest.