wiki:Paravirtualization

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

--

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

Most XVM 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.

Because of the performance benefits, you should consider using a ParaVM if possible.

Converting a Linux Guest to ParaVM

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

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.

Note that the serial console for ParaVMs is /dev/xvc0, not /dev/ttyS0, so you may have to adjust your configuration files.

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 xvm.mit.edu, and then reboot the machine.