wiki:Paravirtualization

Version 1 (modified by broder, 16 years ago) (diff)

--

Xen supports two different types of virtualization: Hardware-supported virtualization (HVM) and paravirtualization (ParaVM).

Most sipb-xen VMs are initially created as HVMs. HVMs virtualize a full machine, down to the metal. They use special processor capabilities to do this. This allows you to run an unmodified operating system. For example, this is the only way to run Windows under Xen. However, I/O performance suffers as a result of this virtualization approach.

ParaVMs on the other hand, modify the guest operating system to remove privileged operations, replacing them with calls to the Xen hypervisor. ParaVMs have significantly better performance, but require a modified kernel. Only a few operating systems have support for running as a paravirtualized Xen guest: Linux, NetBSD, OpenBSD, FreeBSD, and OpenSolaris being the most well known.

The sipb-xen maintainers recommend that servers be converted to ParaVM when possible. Currently, we can offer instructions for upgrading 64-bit installs of Debian or Ubuntu.

Converting a Linux Guest to ParaVM

Pre-requisites

  • 64-bit install It is currently not possible to boot a 32-bit ParaVM kernel on sipb-xen (see #64). This should be possible, but for now, it is only possible to boot 64-bit kernels.
  • DHCP does not work The sipb-xen DHCP server currently does not communicate correctly with a paravirtualized guest, so the IP address will have to be set manually. To do this, edit /etc/network/interfaces and change the line that reads
    iface eth0 inet dhcp
    
    to instead read
    iface eth0 inet static
    address <your static IP address>
    netmask 255.255.0.0
    gateway 18.181.0.1
    

Installing the Necessary Packages

The following packages need to be installed on a Debian guest to get a Xen-capable kernel: linux-image-xen-amd64 linux-headers-xen

On an Ubuntu system, install the following packages: linux-image-xen linux-headers-xen

On Ubuntu, you may also want the linux-restricted-modules-2.6.22-14-xen module (when the kernel version changes, substitute the appropriate version).

Fix Grub

By default, the update-grub script which generates the /boot/grub/menu.lst file will not add Xen kernels when not currently booted as a Xen guest. In order to change this behavior, edit /usr/sbin/update-grub and apply the following patch:

--- update-grub.orig    2008-04-25 16:16:15.000000000 -0400
+++ update-grub 2008-04-25 16:16:43.000000000 -0400
@@ -778,10 +778,12 @@
 
        if [ ! "$in_domU" ] && [ "$is_xen" ]; then
          # skip xen kernels
-          continue
+          # continue
+         :
         elif [ "$in_domU" ] && ! [ "$is_xen" ]; then
          # skip non-xen kernels
-         continue
+         # continue
+         :
         fi
         kern="/boot/$kern"
        newerKernels=""

Then, run /usr/bin/update-grub again.

Enable the Serial Console

ParaVMs currently don't have access to the VNC console; the VM has to be accessed through the SerialConsole. Configure it before rebooting, or it won't be possible to access the VM.

Change the Database Setting

Once you've completed all of these steps, you should be able to shutdown your VM, change the radio button on the VM's info page at sipb-xen-dev.mit.edu, and then reboot the machine.