Monday, June 29, 2009

Xen Kickstart

Below is an example of passing a kickstart config file to virt-install. It took a lot of searching to find how to do this and it is not in the man page. The trick is to use -x (for extra) and then pass it "ks=$URL". The following command will produce a VM named xen-guest with 2 CPUs, 2G of RAM and 8G of disk which will be installed from a kickstart config file:
name="xen-guest"
cpu="2"
ram="2048"
disk="8"
virt-install \
--paravirt \
--file=/var/lib/xen/images/$name.img  \
--name $name \
--vcpus=$cpu \
--ram $ram \
--file-size=$disk \
--nonsparse \
--check-cpu \
--nographics \
--location=http://kickstart.server.com/rhel5.3/ \
-x ks="http://kickstart.server.com/xen.cfg"
Note that the --location option contains the contents of a mounted ISO file, not the ISO file itself. I.e. it was made by mounting the ISO file for the distro as a loop back device inside of /var/www/html/rhel5.3. It is from this mounted ISO file that virt-install downloads the initrd and kernel to boot from and start the install. The kickstart file is then followed and should contain where to get the medium for the install. I did this because I wanted to have a VM which was based on a config which is standard to all of my servers. However, now that I have a Xen guest that I like I've just been using virt-clone and variations of my backup script to create copies and move them between servers.

Xen Backups

Earlier I pointed out how rapleaf.com migrated xen VMs with minimal downtime by using LVM snapshots. I wrote a script to do this very thing to backup my VMs and it works well.

I have three Xen servers and each copies its VMs to the other [backup_target = server_N + 1 % count(xen_servers)]. I shut down each VM, make a snapshot and bring each back up. This results in a 60 second outage for all of the VMs plus boot time with doing a virsh shutdown and then xm create for each VM. I am copying only the image files from /var/lib/xen/images/ and each VM's config file from /etc/xen/.

The majority of time is then spent doing an rsync, however it is not time without service because the VMs would already be back up and the snapshot serves a stable shutdown VM for the backup. My rsync user has the scpsftprsynconly shell, which works nicely and is cleaner than setting up chroot jail. I then only need to boot the VMs on their other host to restore service if there is a hardware problem.

Monday, June 8, 2009

Copying Xen images with minimal downtime & Automating Xen Deployment

This blogger talks about pausing Xen VMs and using LVM snapshots to move Xen images between servers. I also found this white paper on: Automating Xen Virtual Machine Deployment.

Saturday, June 6, 2009

rhel tcptraceroute

RedHat's tcptraceroute is a useless symlink to regular old UDP traceroute. The symlink violates the principle of least surprise. This can get in your way as you quickly try to solve a problem.
$ ls -l `which tcptraceroute` 
lrwxrwxrwx 1 root root 10 May 29 05:35 /bin/tcptraceroute -> traceroute
$ 
They also have nothing in their repository that you can 'yum install'. Come on RedHat, it's GPL'd! To get past this you can update your repository or simply:
wget http://ftp.belnet.be/packages/dries.ulyssis.org/redhat/el5/en/x86_64/RPMS.dries/tcptraceroute-1.5-0.beta7.el5.rf.x86_64.rpm
rpm -iv tcptraceroute-1.5-0.beta7.el5.rf.x86_64.rpm
rm /bin/tcptraceroute
which tcptraceroute
The 'rm' removes the symlink and the 'which' should return /usr/bin/tcptraceroute.

Tuesday, June 2, 2009

Falconstor

Falconstor has a fibre to fibre appliance to stick between a fabric switch and a SAN head (e.g. EMC Clariion cx3-20) to abstract away a set of disks so that you can do live migration between different brands of SAN.

Slice Host

slicehost.com