reevoolabs : open source technology

July 9, 2009

Copying a VM between Xen hosts

Filed under: Uncategorized — louisg @ 2:06 pm

We recently moved a Xen virtual machine from one Xen host to another. The process involves simply copying across its disk partition (in this case an LVM2 partition using the device mapper) and copying across its config file:

1) Copy across the VM partition device.
On target host:


lvcreate -L10G -n vm1-disk xen
nc -l 12345 | dd of=/dev/mapper/xen-vm1--disk conv=nocreat bs=16065b

On source host:


xm shutdown vm1
dd if=/dev/mapper/vm1-disk bs=16065b | nc xen2 12345

2) Copy across the VM config file.


scp /etc/xen/vm1.cfg root@xen2:/etc/xen/

Some further explanation is probably needed for the first step. Creating the logical volume on the target host in advance ensures that the partition, once copied across, remains a block device rather than as an image file. Netcat (nc) provides a fast mechanism to transfer the partition over the ether (use SSH if you’re sensitive about your data). As for the flags to dd, the block size (bs) is set to 16065 bytes, the number of sectors in a cylinder so I’m told (it worked for me), and the nocreat flag tells dd not to overwrite the block device.

Note: remember to shutdown the VM first! This is an offline copy. If you want to minimise downtime I’m sure an LVM snapshot would work too.

July 3, 2009

Testing Apache and mod_rewrite using Test::Unit

Filed under: Uncategorized — matthouse @ 11:04 am

Here at Reevoo we (like many others) use Apache as our webserver of choice and with this comes the venerable mod_rewrite.

Mod_rewrite can be used for a lot more than just redirecting pages though, you can use it for forward and reverse proxying, redirection and url rewriting based on various factors such as the HTTP host or request uri.  However there are myriad ways in which to shoot yourself in the foot!

We love testing, so when an article about testing mod_rewrite rules using Test::Unit by the guys at Viget Labs popped up in my feed reader I quickly popped round to take a look.

Using the redirect tester you can easily define shoulda style tests by doing something like this


class ReevooRedirectTest < HTTPRedirectTest
  self.domain = 'www.reevoo.com'
  should_redirect '/decidewhattobuy/blog', :to => '/decidewhattobuy', :permanant => true
  should_redirect '/blog', :to => '/decidewhattobuy'
end

This is very cool and makes working with mod_rewrite much less painful than it can be!

The original code is a series of gists hosted on the vigetlabs github page and to make them easier to use and manage I packaged it up as a gem, which you can install as follows:

sudo gem sources -a http://gems.github.com && sudo gem install shadowaspect-http_redirect_test

and use it in your code like this:

require 'http_redirect_test'

have fun!

July 2, 2009

Talking Reevoo Santa - It’s creepy and open to abuse.

Filed under: Projects — Tags: , , , — tomlea @ 3:28 pm

Recently the Reevoo office gained a new friend. A 4’6” talking, dancing Santa (because we start Christmas early here). So we hooked him up to our now famous talking rabbit, and now our build notifications are announced by Santa Himself.

As one would expect, the developers (myself most definitely included) began to make Santa announce more than just build statuses and deployments. Santa became our favourite way to drag Edwin, our user experience guru over to our desks (it sure beats turning round and talking).

After some time of this, other Reevolvers (who can’t hack together the ruby code to do this) wanted access… and I felt bad about hogging all the fun.

Enter Reevoo Santa:

Reevoo Santa Screenshot

Reevoo Santa Screenshot

Now the whole office is making Santa say stupid things.

We now come to phase 3, letting the general public (and you too) make Santa say stupid things!

http://santa.reevoo.com/

Please keep the creepy messages to a minimum between 7 and 9pm… the cleaning staff get spooked.

p.s. there is a pool on how long we can keep this live for, 10p says we will be forced to take it down due to wide spread abuse by Monday.

The Reevoo Santa source code is available on github, and is hosted  on Heroku, who host small applications awesomely.

Powered by WordPress