Author Archive

Virtual machines of xen can be created with xen-builtin command xm create which uses a config file in /etc/xen. There is a second command to create xen virtual machines: xm new

Virtual machines created with xm new are permanently added to xen (virtual machines created with xm create get removed from xen when the virtual machine is shut down). – Some xen monitoring tools, like xen orchestra, rely on permanently added virtual machines.

But xm new is broken in debian (and ubuntu) because xm uses an outdated xml python library. And the corresponding debian  bug report is closed with status ‘won’t fix’. Debian maintainers support  only xen create.

Using virsh as workaround for xen new:

  • xm create myvm (from file /etc/xen/myvm)
  • virsh dumpxml myvm > /etc/xen/myvm.xml
  • xm shutdown myvm
  • virsh define /etc/xen/myvm.xml

Debian sid has the source package of libvirt (currently 0.8.1-1), but package 0.8.1-1 does not work with xen 4.0.  However the build service of opensuse factory includes as well libvirt-0.8.1 and they have xen 4.0 patches included.

To get a libvirt package for ubuntu 10.04 which is compatible with xen 4.0 the patches of opensuse had to be combined with the debian sid package (patch: debian.diff; local copy of debian sources: libvirt_0.8.1.orig.tar.gz, libvirt_0.8.1-1.debian.tar.gz, libvirt_0.8.1-1.dsc).

Build process:

  • download sources and patch into new directory and open terminal in this directory
  • tar -xzf libvirt_0.8.1.orig.tar.gz
  • cd libvirt-0.8.1
  • tar -xzf ../libvirt_0.8.1-1.debian.tar.gz
  • patch -p0 < ../debian.diff
  • ./debian/rules binary

And to install the new packages (ubuntu amd64 packages: libvirt-bin_0.8.1-1_amd64.deb, libvirt0_0.8.1-1_amd64.deb, libvirt-dev_0.8.1-1_amd64.deb, libvirt-doc_0.8.1-1_amd64.deb, python-libvirt_0.8.1-1_amd64.deb, libvirt0-dbg_0.8.1-1_amd64.deb):

  • cd ..
  • dpkg -i libvirt0_0.8.1-1_amd64.deb libvirt-bin_0.8.1-1_amd64.deb python-libvirt_0.8.1-1_amd64.deb

The resulting virsh command seems to work with xen 4.0 (tested with subcommands dumpxml and define). – You should use Package/Force version in synaptic package manager to protect these manually installed packages.

  • Adding and removing of hard disks  and cdrom devices works fine
    (guest not running)
  • Acronis Trueimage works well inside hvm virtual machines
    (if empty block devices are not recognized as hard disks, e.g. /dev/sdb7:
    dd if=/dev/zero of=/dev/sdb7 bs=1M count=100
    echo ‘w’ |fdisk /dev/sdb7
    This zeros out the beginning of block device /dev/sdb7 and writes a new partition table into /dev/sdb7; all existing data in /dev/sdb7 is overwritten – you have been warned.)
  • Sometimes the window opened by virt-manager fails to display a running virtual machine (does not connect by vnc to the running vm).
    Closing both windows (that of the vm and virt-manager itself) and reopening them usually helps (the vm continues to run).

Found in xen wiki a remark of Jeremy Fitzhardinge about the performance of Xen 4.0 (Xen Summit at Intel Shanghai Nov 19-20, 2009, Slide 7):

Performance still needs attention

  • Seems to be ~10-20% hit vs 2.6.18-xen

… but you get a current 2.6.31/32/… Linux kernel.

Preparations to boot a Xen 4.0 dom0  kernel: 2.6.18-to-2.6.31-and-higher

Status of Xen features in Linux kernel: XenParavirtOps

Thanks to the detailed posts on http://bderzhavets.wordpress.com/ [A, B, C ] virt-manager is running xen 4.0 on ubuntu 10.04
(installation of ubuntu server plus apt-get install xubuntu-desktop).

Program virt-manager has to be started as root and switching with su to root shell does not work, the login version su – has to be used (to avoid error: Failed to contact configuration server).

To create a hvm virtual machine virt-install is used:

  • virt-install -connect xen:/// -n ti2010 –r 512 –hvm –vnc -f /dev/sdb -c /root/mnt/ti2010.iso –debug –force

Parameter –force is only neccessary if the block device used as hard disk is already part of another vm.

Once the new vm gets displayed in virt-manager all properties of this vm can be edited (click ‘Open’; ‘Add Hardware’, ‘Remove’, …).