====== Install Xen ====== ===== Xend configuration ===== Well ''xend'' configuration is pretty easy to do. I remember having hard time with it, but by moving network part to network configuration seems to make it much more simpler. Here's my configuration : # We want migration (xend-relocation-server yes) # We want it on port 8002 (xend-relocation-port 8002) # We want to listen on the whole network, but don't specify an IP if you use OCFS2 shared configuration as shown below (xend-relocation-address '') # We don't do any change on our network configuration when Xen start (network-script network-dummy) # We use bridging (vif-script vif-bridge) # I want at least 196Mo for my dom0. You to tune this value. (dom0-min-mem 196) # I give all my CPU to dom0 (default) (dom0-cpu 0) ===== Bridge setup ===== I choose to setup the bridge in the network configuration instead of using xen scripts. Xen scripts don't work well with channel bonding. This in ''/etc/network/interfaces'' will first setup channel bonding then it'll add bridging auto br0 iface br0 inet static address 192.168.10.9 netmask 255.255.255.0 broadcast 192.168.10.255 network 192.168.10.0 gateway 192.168.10.1 dns-nameservers 192.168.10.5 dns-search irovision.ch pre-up ip link set eth0 up pre-up ip link set eth1 up pre-up modprobe bond0 pre-up ip link set bond0 up pre-up ifenslave bond0 eth0 eth1 pre-up modprobe bridge pre-up brctl addbr br0 pre-up brctl addif br0 bond0 pre-up brctl stp br0 off pre-up brctl setfd br0 0 FIXME actually if you ''ifdown br0'' then ''ifup br0'' it'll fail because the network configuration doesn't disable the bridge and un-enslave network card from the bond. I'll do it ... ==== Note on bonding ==== To make bonding works, you need to create a file in ''/etc/modprobe.d/'' in order to define how your bonding driver will be loaded by the kernel. I called this file ''bonding'' : # For channel bonding # File /etc/modprobe.d/bonding alias bond0 bonding options bond0 mode=1 miimon=100 downdelay=200 updelay=200 ===== Using OCFS2 and Xen together (for migration) ===== Ok this works very well. You just need to correct some little details. First of all, I use ''xen-tools'' which works very, very well. It allows to create new virtual server in less than a second when correctly configured. Like ''xen-create-image --hostname=vserver18 --ip=10.0.0.18'' and you've got a Debian Etch ready to run and to migrate around ... First I've installed the vserver linux image from Debian : ''sudo aptitude install linux-image-2.6.18-6-xen-vserver-686''. This provide kernel for virtual server running on the top of Xen. I've a OCFS2 volume mounted on ''/srv/os_img_pool''. This is where my Xend configuration and my virtual server image reside. So in ''/etc/xen-tools/xen-tools.conf'', I've set ''dir = /srv/os_img_pool/''. So here is my ''xen-tools.conf'' : # Where all my xen image reside dir = /srv/os_img_pool # I use debootstrap to generate a new vserver deboostrap = 1 # My default value for disk size, memory and swap size = 5Gb memory = 256Mb swap = 256Mb # I want ext3, use etch distrib and use spare disk images fs = ext3 dist = etch image = sparse # I set default value for my network gateway = 10.0.0.254 netmask = 255.255.255.0 # Path to Debian virtual server linux image kernel = /boot/vmlinuz-2.6.18-6-xen-vserver-686 initrd = /boot/initrd.img-2.6.18-6-xen-vserver-68 # My debian mirror (from switzerland) mirror = http://ftp.ch.debian.org/debian/ Then I created ''/srv/os_img_pool/conf'' and I copied in it ''/etc/xen'' : ''cp -a /etc/xen/ /srv/os_img_pool/conf/''. I did this to share the same ''xend'' configuration between all my ''dom0''. You only need to create a symbolic link : X00:~# mv /etc/xen /etc/xen.bck X00:~# ln -s /srv/os_img_pool/conf/xen /etc/xen What is very important here, is that you do this on all your dom0. You can use ''clusterssh'' to command all your dom0 at once. But if you've 4 dom0 (X00 to X03), both command should be done on X00 to X03 with the OCFS2 volume mounted. I didn't put the ''xen-tools'' configuration on the OCFS2 volume ... Why ? Did thing of that while writing this document, so I will do it later, but by applying the same process you would have the same ''xen-tools'' configuration on every ''dom0'' (instead of copying it by hand like I did). Now that you've the same configuration for ''xen-tools'' and ''xend'' on every dom0, you can issue the ''xen-create-image'' command and start a new virtual server, migrate, ... ==== The tragic story of Debian not mounting OCFS2 volume at boot time ==== That's true. It works in Lenny, but actually it's not sure that Lenny could run as dom0. So I've made a little the script that would do the job. #! /bin/sh ### BEGIN INIT INFO # Provides: mountocfs2 # Required-Start: o2cb $local_fs # Required-Stop: # Should-Start: $network # Default-Start: S # Default-Stop: # Short-Description: Wait for o2cb service to mount ocfs2 # Description: OCFS2 Filesystem are not correctly handled by # mountnfs.sh, this script should correct that. ### END INIT INFO PATH=/sbin:/bin . /lib/init/vars.sh . /lib/lsb/init-functions . /lib/init/mount-functions.sh do_start() { [ -f /etc/fstab ] || return exec 9<&0 &2 exit 3 ;; stop) # Nop ;; *) echo "Usage: mountocfs2.sh [start|stop]" >&2 exit 3 ;; esac : {{debian:xen:mountocfs2.sh.txt|The script ...}} Put this script in ''/etc/init.d/'' and then add to your start up sequence (the S level and after 60, because ''o2cb'' starts at 60) with the command ''update-rc.d'' : $ sudo update-rc.d mountocfs2.sh start 61 S . Then you're system is really ready to work. ===== Notes ===== * Read my page about [[debian:fs:ocfs2|OCFS2]].