Wednesday, July 27, 2011

Migrating running VMs using virsh

Prerequisites:


  1. All VM images are mounted on a shared location,  for example: /vmimages. If any images are qcow2 images with a backing file, those files also need to be present on shared locations.
  2. kvm-pxe needs to be installed. If not, the migration occurs, but the VM is suspended at the destination.
  3. Optional: If you want to be able to do this from scripts, setup ssh keys so you don't need to enter passwords


Migrate with the following command as root on the source host:


virsh migrate --live vmname qemu+ssh://destination.host/system

or if you are not on source, you can first connect to the source host


virsh --connect qemu://source.host/system migrate --live vmname \
      qemu+ssh://destination.host/system



Sunday, July 03, 2011

Read only root on VMs

Follow the instructions from here: https://help.ubuntu.com/community/aufsRootFileSystemOnUsbFlash


disable app-armor on dhclient (otherwise networking will fail)
sudo aa-complain /etc/apparmor.d/sbin.dhclient




edit /etc/grub.d/00_header to not show menu on unclean close:


# if [ "\${recordfail}" = 1 ]
# then
set timeout=-1
#else
set timeout=${2}
#fi


Optionally, you can choose to not unmount NFS paritions, etc in /etc/rc0.d/S35networking and S40unmountfs