I’ve recently been playing with Xen on Centos 5. In the following notes, PM is Physical Machine (domain 0) and VM is a Virtual Machine (domain U)

Features of Xen (3.03):

  • Resize the memory of a VM, but not larger than the size the VM was originally created with. But, when you migrate a VM to another PM, you must have enough RAM available to run the VM with it’s original memory size. Once moved, it will be shrunk to whatever it was running before. This is an issue if you want to shrink a load of running VMs and move them live to a machine with less RAM. Of course, you can just migrate them non-live, but who wants to do that?

Resources

Xen commands

xen list 
xen migrate --live vm1 pm2
xen mem-set pm1 1024

Xen Config

I have 2 separate config files, one to install the VM and one to run it day to day. The install config file uses a small amount of RAM and number of VCPUs, as this is all that is needed. I also hardcode the mac addresses as all our machines get static IPs from DHCP. Everything lives on NFS, so we can migrate machines. The kernel and ramdisk are the Xen supplied ones (taken from http://wiki.centos.org/HowTos/Xen/InstallingCentOSDomU).

yoshi-1-inst

kernel = "/net/nfs7/vol8/xen/vmlinuz.gz"
ramdisk = "/net/nfs7/vol8/xen/initrd.img.gz"
extra = "text ks=nfs:nfs7:/vol/vol21/abacus-server/kickstart/cfg/00:16:3e:1b:82:bd"
name = "yoshi-1"
memory = "512"
disk = ['file:/net/nfs7/vol8/xen/yoshi-1.img,xvda,w']
vif = ['bridge=xenbr0,mac=00:16:3e:1b:82:bd']
vcpus=1
on_reboot = 'destroy'
on_crash = 'destroy'

yoshi-1-run

name = "yoshi-1"
memory = "8192"
disk = ['file:/net/nfs7/vol8/xen/yoshi-1.img,xvda,w']
vif = ['bridge=xenbr0,mac=00:16:3e:1b:82:bd']
vcpus=1
on_reboot = 'restart'
on_crash = 'restart'
bootloader='/usr/bin/pygrub'

Xen and Centos 5

  • Install Centos 5
  • yum groupinstall virtualization
  • Edit /etc/grub.conf and change default to 0, so it boots the Xen kernel
  • Reboot
  • Create config files based on above
  • xm create /path/to/your/yoshi-1-inst
  • xm console yoshi-1
  • VM should be running and installing from Kickstart. After install it’ll die.
  • xm create /path/to/your/yoshi-1-run
  • xm console yoshi-1
  • You should have a console now on your running machine.
 
xen_virtualisation.txt · Last modified: 2007/09/11 09:45 by gavin
 
Recent changes RSS feed Valid XHTML 1.0 Valid CSS Driven by DokuWiki