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.
Blog of spblinux » Blog Archive » Managing xen 4.0 with xen orchestra says:
[…] « Xen 4.0 with libvirt-0.8.1 – replace ‘xm new’ by virsh […]
May 26, 2010, 15:19Jonathan says:
Hi There,
I used the Ubuntu packages above, however when I try and launch virt-manager, or even try “virsh connect xen:///” for the command line, is says that “no hypervisor driver available for xen:///”
Any ideas?
xm list works ok for me, however I don’t think that’s related to libvirt. xm list just proves that my Xend is running and listening
Thanks
June 3, 2010, 00:44spblinux says:
Hi Jonathan,
try to compare with getting-virt-install-to-work…
– did you uncomment (xend-unix-server yes) in the config file of xend in /etc/xen/?
– adding export VIRSH_DEFAULT_CONNECT_URI=”xen:///” to .bashrc makes xend the default connect option
– on my test machine all commands where run as root user
spblinux
June 3, 2010, 22:29Boris says:
http://www.fsdaily.com/HighEnd/Set_up_Libvirt_0_8_0_Xen_4_0_on_top_of_Ubuntu_10_04_Server_via_Daniel_Baumann_Virtualization_PPA
June 4, 2010, 21:42Boris says:
I’ve also failed to reproduce yours sample above on clean install Ubuntu 10.04
June 4, 2010, 21:57server. Looked like i still missed packages to run ./debian/rules binary.
It was complaining 3 rules . Some files in locations like /usr/lib/../..
were missing. I had installed all packages mentioned here:-
http://bderzhavets.wordpress.com/2010/04/24/set-up-ubuntu-10-04-server-pv-domu-at-xen-4-0-dom0-pvops-2-6-32-10-kernel-dom0-on-top-of-ubuntu-10-04-server/
spblinux says:
The packages currently installed on my ubuntu 10.04 amd64 setup (ubuntu server install extended with xubuntu-desktop package) are listed here: dpkg.txt and dpkg-dev.txt (listing only ‘-dev’ packages). – Maybe you can document here in the comments which packages you add to add to your setup.
June 4, 2010, 23:29Addendum: I think that I had to reboot once to get libvirtd running; /etc/init.d/libvirt-bin start did not work; (ps ax |grep libvirtd).