--- libvirt-0.4.6.orig/debian/libvirt-bin.default +++ libvirt-0.4.6/debian/libvirt-bin.default @@ -0,0 +1,11 @@ +# Defaults for libvirt-bin initscript (/etc/init.d/libvirt-bin) +# This is a POSIX shell fragment + +# Start libvirtd to handle qemu/kvm: +start_libvirtd="yes" + +# options passed to libvirtd, add "-l" to listen on tcp +libvirtd_opts="-d" + +# pass in location of kerberos keytab +#export KRB5_KTNAME=/etc/libvirt/libvirt.keytab --- libvirt-0.4.6.orig/debian/watch +++ libvirt-0.4.6/debian/watch @@ -0,0 +1,3 @@ +# format version number, currently 3; this line is compulsory! +version=3 +http://libvirt.org/sources/libvirt-([\d\.]*)\.tar\.gz --- libvirt-0.4.6.orig/debian/python-libvirt.install +++ libvirt-0.4.6/debian/python-libvirt.install @@ -0,0 +1,2 @@ +usr/lib/python*/*/*.so +usr/lib/python*/*/*.py --- libvirt-0.4.6.orig/debian/compat +++ libvirt-0.4.6/debian/compat @@ -0,0 +1 @@ +5 --- libvirt-0.4.6.orig/debian/libvirt-doc.links +++ libvirt-0.4.6/debian/libvirt-doc.links @@ -0,0 +1 @@ +usr/share/doc/libvirt-doc/devhelp/ /usr/share/gtk-doc/html/libvirt --- libvirt-0.4.6.orig/debian/libvirt0.install +++ libvirt-0.4.6/debian/libvirt0.install @@ -0,0 +1,2 @@ +usr/lib/libvirt.so.* + --- libvirt-0.4.6.orig/debian/libvirt-bin.postinst +++ libvirt-0.4.6/debian/libvirt-bin.postinst @@ -0,0 +1,44 @@ +#!/bin/sh +# postinst script for libvirt-bin +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-remove' +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + configure) + if ! getent group libvirt >/dev/null; then + addgroup --system libvirtd + fi + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + --- libvirt-0.4.6.orig/debian/libvirt-doc.doc-base.libvirt-doc +++ libvirt-0.4.6/debian/libvirt-doc.doc-base.libvirt-doc @@ -0,0 +1,8 @@ +Document: libvirt-doc +Title: Libvirt the virtualization API +Abstract: Local copy of the web site of libvirt +Section: Administration + +Format: HTML +Index: /usr/share/doc/libvirt-doc/intro.html +Files: /usr/share/doc/libvirt-doc/*.html --- libvirt-0.4.6.orig/debian/libvirt-bin.dirs +++ libvirt-0.4.6/debian/libvirt-bin.dirs @@ -0,0 +1,4 @@ +/var/run/libvirt +/var/lib/libvirt/images +/var/lib/libvirt/boot +/var/cache/libvirt --- libvirt-0.4.6.orig/debian/libvirt-dev.install +++ libvirt-0.4.6/debian/libvirt-dev.install @@ -0,0 +1,4 @@ +usr/lib/libvirt.so +usr/lib/libvirt.a +usr/include/* +usr/lib/pkgconfig/* --- libvirt-0.4.6.orig/debian/libvirt-suspendonreboot +++ libvirt-0.4.6/debian/libvirt-suspendonreboot @@ -0,0 +1,41 @@ +#! /bin/bash + +# (c) Andi Barth 2008 +# Distributable under the terms of the GNU GPL version 2. +# +# copy to /etc/init.d/libvirt-suspendonreboot and use +# update-rc.d libvirt-suspendonreboot defaults 21 19 +# to enable + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin + +suspenddir=/var/lib/libvirt/autosuspend + +case "$1" in + start) + for domain in ${suspenddir}/*dump; do + if [ -f $domain ]; then + domain=$(basename $domain .dump) + echo "resuming $domain ..." + virsh restore ${suspenddir}/${domain}.dump && rm ${suspenddir}/${domain}.dump + fi + done + ;; + stop) + for domain in /etc/libvirt/qemu/*xml; do + domain=$(basename $domain .xml) + state=$(virsh domstate $domain) + if [ "$state" == "running" ]; then + echo "suspending $domain ..." + virsh save ${domain} ${suspenddir}/${domain}.dump + fi + done + ;; + reload|force-reload|restart) + # No action, nothing to reload + ;; + *) + echo "Usage: $0 {start|stop|restart|reload|force-reload}" >&2 + exit 1 +esac + --- libvirt-0.4.6.orig/debian/libvirt-bin.install +++ libvirt-0.4.6/debian/libvirt-bin.install @@ -0,0 +1,5 @@ +usr/bin/* +usr/sbin/* +etc/libvirt/* +etc/sasl2/* +usr/share/PolicyKit/* --- libvirt-0.4.6.orig/debian/README.Debian +++ libvirt-0.4.6/debian/README.Debian @@ -0,0 +1,49 @@ +Xen +=== +For working xen support you have to set: + +(xend-http-server yes) +(xend-unix-server yes) +(xend-address localhost) + +in /etc/xen/xend-config.sxp. The last line makes sure xend is only accepting +connections on localhost. + +Debugging +========= +Use LIBVIRT_DEBUG=1 to enable libvirt's debugging output, e.g.: + +LIBVIRT_DEBUG=1 +export LIBVIRT_DEBUG +virt-manager + +The default NAT network +======================= +To ease network configuration libvirt defines a NATed network named "default". +VMs using this network end up in 192.168.122.1/24 and DHCP is provided to them +via dnsmasq. This network is not automatically started. To start it use: + + virsh net-start default + +To make the default network start automatically use: + + virsh net-autostart default + +In order for things to work this way you need to have the recommended packages +dnsmasq, bridge-utils and iptables installed. However Debian's default dnsmasq +configuration conflicts with the way libvirtd wants to invoke it. You have two +possibilities: + + * don't start dnsmasq via /etc/init.d/dnsmasq during system startup and let + libvirtd handle dnsmasq completely + + * use "interface=lo" and "bind-interfaces" in dnsmasq.conf + +See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=504605 for more information. + +Access Control +============== +Access to the libvirt socket is controlled by membership in the libvirt group. +If you want to manage VMs as non root you need to add a user to that group. + + -- Guido Guenther Thu, 15 May 2008 14:13:03 +0100 --- libvirt-0.4.6.orig/debian/pycompat +++ libvirt-0.4.6/debian/pycompat @@ -0,0 +1 @@ +2 --- libvirt-0.4.6.orig/debian/libvirt-bin.examples +++ libvirt-0.4.6/debian/libvirt-bin.examples @@ -0,0 +1,5 @@ +qemud/libvirtd.policy +qemud/libvirtd.sasl +qemud/libvirtd.conf +debian/libvirt-suspendonreboot + --- libvirt-0.4.6.orig/debian/libvirt-bin.postrm +++ libvirt-0.4.6/debian/libvirt-bin.postrm @@ -0,0 +1,45 @@ +#!/bin/sh +# postrm script for #PACKAGE# +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `purge' +# * `upgrade' +# * `failed-upgrade' +# * `abort-install' +# * `abort-install' +# * `abort-upgrade' +# * `disappear' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + purge) + if getent group libvirt >/dev/null; then + delgroup libvirt || true + fi + + ;; + remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + + --- libvirt-0.4.6.orig/debian/libvirt-doc.docs +++ libvirt-0.4.6/debian/libvirt-doc.docs @@ -0,0 +1,8 @@ +docs/*.rng +docs/*.png +docs/*.xml +docs/*.html +docs/*.gif +docs/examples/ +docs/html/ +docs/devhelp/ --- libvirt-0.4.6.orig/debian/libvirt-bin.manpages +++ libvirt-0.4.6/debian/libvirt-bin.manpages @@ -0,0 +1 @@ +virsh.1 --- libvirt-0.4.6.orig/debian/README.source +++ libvirt-0.4.6/debian/README.source @@ -0,0 +1,57 @@ +This package uses quilt to manage all modifications to the upstream +source. Changes are stored in the source package as diffs in +debian/patches and applied during the build. + +To configure quilt to use debian/patches instead of patches, you want +either to export QUILT_PATCHES=debian/patches in your environment +or use this snippet in your ~/.quiltrc: + + for where in ./ ../ ../../ ../../../ ../../../../ ../../../../../; do + if [ -e ${where}debian/rules -a -d ${where}debian/patches ]; then + export QUILT_PATCHES=debian/patches + fi + done + +To get the fully patched source after unpacking the source package, cd to +the root level of the source package and run: + + quilt push -a + +The last patch listed in debian/patches/series will become the current +patch. + +To add a new set of changes, first run quilt push -a, and then run: + + quilt new + +where is a descriptive name for the patch, used as the filename in +debian/patches. Then, for every file that will be modified by this patch, +run: + + quilt add + +before editing those files. You must tell quilt with quilt add what files +will be part of the patch before making changes or quilt will not work +properly. After editing the files, run: + + quilt refresh + +to save the results as a patch. + +Alternately, if you already have an external patch and you just want to +add it to the build system, run quilt push -a and then: + + quilt import -P /path/to/patch + quilt push -a + +(add -p 0 to quilt import if needed). as above is the filename to +use in debian/patches. The last quilt push -a will apply the patch to +make sure it works properly. + +To remove an existing patch from the list of patches that will be applied, +run: + + quilt delete + +You may need to run quilt pop -a to unapply patches first before running +this command. --- libvirt-0.4.6.orig/debian/rules +++ libvirt-0.4.6/debian/rules @@ -0,0 +1,48 @@ +#!/usr/bin/make -f + +DEB_PYTHON_SYSTEM=pycentral +DEB_DH_INSTALL_SOURCEDIR = debian/tmp + +ifneq (,$(findstring $(DEB_HOST_ARCH), i386 amd64)) + BUILD_XEN=--with-xen +else + BUILD_XEN=--without-xen +endif + +include /usr/share/cdbs/1/rules/debhelper.mk +include /usr/share/cdbs/1/class/autotools.mk +include /usr/share/cdbs/1/class/python-distutils.mk +include /usr/share/cdbs/1/rules/patchsys-quilt.mk + +DEB_CONFIGURE_EXTRA_FLAGS := \ + --disable-rpath \ + --with-qemu \ + --without-openvz \ + --without-lxc \ + --with-avahi \ + --with-sasl \ + --with-polkit \ + --with-storage-fs \ + --with-storage-lvm \ + --with-storage-iscsi \ + --with-storage-disk \ + --with-init-scripts=none \ + --without-numactl \ + --enable-debug \ + $(BUILD_XEN) + +DEB_DBG_PACKAGES = libvirt0-dbg +DEB_DBG_PACKAGE_libvirt0 = libvirt0-dbg +DEB_PYTHON_SETUP_CMD := /dev/null +DEB_DH_MAKESHLIBS_ARGS_libvirt0 += -V 'libvirt0 (>= 0.4.5)' +DEB_DH_INSTALLINIT_ARGS := --no-restart-on-upgrade + +EXAMPLES=debian/libvirt-doc/usr/share/doc/libvirt-doc/examples/ + +binary-install/libvirt-doc:: + cd $(EXAMPLES) && rm -rf .libs *.o info1 suspend ../html/CVS + +redo-patches:: + rm -f debian/patches/* + git format-patch -N -o debian/patches master...patch-queue | \ + sed -e 's%debian/patches/%%' > debian/patches/series --- libvirt-0.4.6.orig/debian/libvirt-bin.init +++ libvirt-0.4.6/debian/libvirt-bin.init @@ -0,0 +1,159 @@ +#! /bin/sh +# +# Init skript for libvirtd +# +# (c) 2007 Guido Guenther +# based on the skeletons that comes with dh_make +# +### BEGIN INIT INFO +# Provides: libvirtd +# Required-Start: $network $local_fs +# Required-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: libvirt management daemon +### END INIT INFO + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DAEMON=/usr/sbin/libvirtd +NAME=libvirtd +DESC="libvirt management daemon" + +test -x $DAEMON || exit 0 +. /lib/lsb/init-functions + +PIDFILE=/var/run/$NAME.pid +DODTIME=1 # Time to wait for the server to die, in seconds + +# Include libvirtd defaults if available +if [ -f /etc/default/libvirt-bin ] ; then + . /etc/default/libvirt-bin +fi + +set -e + +check_start_libvirtd_option() { + if [ ! "$start_libvirtd" = "yes" ]; then + log_warning_msg "Not starting libvirt management daemon libvirtd, disabled via /etc/default/libvirt-bin" + return 1 + else + return 0 + fi +} + +running_pid() +{ + # Check if a given process pid's cmdline matches a given name + pid=$1 + name=$2 + [ -z "$pid" ] && return 1 + [ ! -d /proc/$pid ] && return 1 + cmd=`cat /proc/$pid/cmdline | tr "\000" "\n"|head -n 1 |cut -d : -f 1` + # Is this the expected child? + [ "$cmd" != "$name" ] && return 1 + return 0 +} + +running() +{ +# Check if the process is running looking at /proc +# (works for all users) + # No pidfile, probably no daemon present + [ ! -f "$PIDFILE" ] && return 1 + # Obtain the pid and check it against the binary name + pid=`cat $PIDFILE` + running_pid $pid $DAEMON || return 1 + return 0 +} + +force_stop() { +# Forcefully kill the process + [ ! -f "$PIDFILE" ] && return + if running ; then + kill -15 $pid + # Is it really dead? + [ -n "$DODTIME" ] && sleep "$DODTIME"s + if running ; then + kill -9 $pid + [ -n "$DODTIME" ] && sleep "$DODTIME"s + if running ; then + echo "Cannot kill $LABEL (pid=$pid)!" + exit 1 + fi + fi + fi + rm -f $PIDFILE + return 0 +} + +case "$1" in + start) + if check_start_libvirtd_option; then + log_daemon_msg "Starting $DESC" "$NAME" + if running ; then + log_progress_msg "already running" + log_end_msg 0 + exit 0 + fi + rm -f /var/run/libvirtd.pid + mkdir -p /var/run/libvirt + start-stop-daemon --start --quiet --pidfile $PIDFILE \ + --exec $DAEMON -- $libvirtd_opts + running && log_end_msg 0 || log_end_msg 1 + fi + ;; + stop) + log_daemon_msg "Stopping $DESC" "$NAME" + if ! running ; then + log_progress_msg "not running" + log_end_msg 0 + exit 0 + fi + start-stop-daemon --stop --quiet --pidfile $PIDFILE \ + --exec $DAEMON + log_end_msg 0 + ;; + force-stop) + log_daemon_msg "Forcefully stopping $DESC" "$NAME" + force_stop + ! running && log_end_msg 0 || log_end_msg 1 + ;; + restart) + if check_start_libvirtd_option; then + log_daemon_msg "Restarting $DESC" "$DAEMON" + start-stop-daemon --oknodo --stop --quiet --pidfile \ + /var/run/$NAME.pid --exec $DAEMON + [ -n "$DODTIME" ] && sleep $DODTIME + start-stop-daemon --start --quiet --pidfile \ + /var/run/$NAME.pid --exec $DAEMON -- $libvirtd_opts + running && log_end_msg 0 || log_end_msg 1 + fi + ;; + reload|force-reload) + if running; then + log_daemon_msg "Reloading configuration of $DESC" "$NAME" + start-stop-daemon --stop --signal 1 --quiet --pidfile \ + /var/run/$NAME.pid --exec $DAEMON + log_end_msg 0 + else + log_warning_msg "libvirtd not running, doing nothing." + fi + ;; + status) + log_daemon_msg "Checking status of $DESC" "$NAME" + if running ; then + log_progress_msg "running" + log_end_msg 0 + else + log_progress_msg "not running" + log_end_msg 1 + fi + ;; + *) + N=/etc/init.d/libvirt-bin + echo "Usage: $N {start|stop|restart|reload|force-reload|status|force-stop}" >&2 + exit 1 + ;; +esac + +exit 0 --- libvirt-0.4.6.orig/debian/changelog +++ libvirt-0.4.6/debian/changelog @@ -0,0 +1,637 @@ +libvirt (0.4.6-5ubuntu1) jaunty; urgency=low + + * Merge from debian unstable, remaining changes: + - debian/control: + + Don't build-depend on QEmu. + + Add "XS-Debian-" prefix to Debian's Vcs headers. + + Bump bridge-utils, dnsmasq-base, netcat-openbsd, and iptables to Depends + of libvirt-bin. + + s/interract/interact/g + + Add versioned Conflicts/Replaces to libvirt0 for libvirt0-dbg, since + we used to ship them as such. + - Create /var/run/libvirt in libvirt-bin's init script. + - Rename libvirt group to libvirtd. + - 0005-delayed_iff_up_bridge.patch: Don't try to bring up the bridge before at + least one interface has been added to it. + - dont_clobber_existing_bridges.patch: Assign the name of the virtual + bridge dynamically to avoid interfering with existing bridges. + - better_default_uri_virsh.patch: Default to qemu:///system if the user + has write access to the libvirt socket, otherwise qemu:///session. + - We call libxen-dev libxen3-dev, so change all references. + * Add qemu migration patch (from upstream git (adjusted for 0.4.6)). + * Add dynamic_bridge_names.patch to again support dynamic bridge names. + + -- Soren Hansen Tue, 18 Nov 2008 18:04:40 +0100 + +libvirt (0.4.6-5) unstable; urgency=low + + * [411ada3] add more details about dnsmasq vs. libvirtd (Closes: #504605) + * [2f8f07d] add default image dir virt-manager assumes they exist and + they're used in the SELinux policies too. (Closes: #505577) + * [9eb3a83] fix #define vs. #defined typos - affects non Linux architectures + and fixes the build with gcc 4.4 (Closes: #505607) - thanks to Martin + Michlmayr + * [0e21634] fix uploader + + -- Guido Günther Fri, 14 Nov 2008 14:54:48 +0100 + +libvirt (0.4.6-4) unstable; urgency=low + + * upload to unstable + * [50b27f5] add libvirt-suspendonreboot script (Closes: #501155) - + thanks to Andreas Barth + + -- Guido Günther Sat, 01 Nov 2008 19:33:36 +0100 + +libvirt (0.4.6-3) experimental; urgency=low + + * [8fa5a3c] add a versioned recommends on qemu (Closes: #501692) + * [d1539bc] recommend pkg-config + * [f08bb18] explain libvirt group (Closes: #501824) + + -- Guido Günther Sun, 12 Oct 2008 20:27:25 +0200 + +libvirt (0.4.6-2) experimental; urgency=low + + * [2039095] tighten libvirt dependency + * [06dbe8a] qemu/kvm: fix domain block stats for virtio and scsi devices + + -- Guido Günther Thu, 02 Oct 2008 22:03:05 +0200 + +libvirt (0.4.6-1) experimental; urgency=low + + * [e20d3d4] Imported Upstream version 0.4.6 + * [0c840ab] disable numactl + * [ca2c5cb] cleanup doc installation (Closes: #492075) + * [714ab94] drop 0004-for-kvm-determine-maxVCPUs-at-runtime.patch - applied + upstream + * [e7563a8] drop 0005-fix-crash-when-no-emulator-is-defined-for-kvm- + qemu.patch - fixed upstream + + -- Guido Guenther Thu, 25 Sep 2008 12:31:45 +0200 + +libvirt (0.4.5-2) experimental; urgency=low + + * [17647cd] libvirt-bin.default: add keytab default + * [0ef01e7] fix runtime vcpu detection (0004-for-kvm-determine- + maxVCPUs-at-runtime.patch) (Closes: #495950) + * [b91e1eb] don't crash when no emulator is defined (0005-fix-crash- + when-no-emulator-is-defined-for-kvm-qemu.patch) + + -- Guido Guenther Mon, 22 Sep 2008 20:11:04 +0200 + +libvirt (0.4.5-1) experimental; urgency=low + + * [ab8b4e6] Imported Upstream version 0.4.5 + * [4aaef27] tighten dependency on libvirt + * [fa253be] drop 0002-qemu-path.diff.patch - fixed upstream + * [87fc2db] drop 0005-check-for-the-existence-of-the-migrate- + command.patch applied upstream + * [bc311aa] drop 0006-wrong-open-failure-detection.patch applied + upstream + * [38e615d] rebase the remaining patches + * [9a04bb7] bump shlibs version to 0.4.5 + * [9fadd6f] disable LXC + * [179c869] build-dep on libselinux1-dev for selinux support + + -- Guido Guenther Thu, 18 Sep 2008 19:02:55 +0200 + +libvirt (0.4.4-3ubuntu3) intrepid; urgency=low + + * debian/patches/0008-lp287533.patch: allow 16 VCPUs when using kvm + (LP: #287533) + + -- Jamie Strandboge Wed, 22 Oct 2008 10:13:12 -0500 + +libvirt (0.4.4-3ubuntu2) intrepid; urgency=low + + * Make QEmu a suggested package of libvirt0 rather than a recommended one. + * Make kvm a recommended package of libvirt0. + + -- Soren Hansen Mon, 11 Aug 2008 16:18:03 +0200 + +libvirt (0.4.4-3ubuntu1) intrepid; urgency=low + + * Merge from debian unstable, remaining changes: + - debian/control: + + DebianMaintainerField + + Don't build-depend on QEmu. + + Add "XS-Original-" prefix to Debian's Vcs headers. + + Bump bridge-utils, dnsmasq-base, netcat-openbsd, and iptables to Depends + of libvirt-bin. + + s/interract/interact/g + + Add versioned Conflicts/Replaces to libvirt0 for libvirt0-dbg, since + we used to ship them as such. + - Create /var/run/libvirt in libvirt-bin's init script. + - Rename libvirt group to libvirtd. + - 0005-delayed_iff_up_bridge.patch: Don't try to bring up the bridge before at + least one interface has been added to it. + - dont_clobber_existing_bridges.patch: Assign the name of the virtual + bridge dynamically to avoid interfering with existing bridges. + - better_default_uri_virsh.patch: Default to qemu:///system if the user + has write access to the libvirt socket, otherwise qemu:///session. + - We call libxen-dev libxen3-dev, so change all references. + + -- Soren Hansen Mon, 11 Aug 2008 15:36:54 +0200 + +libvirt (0.4.4-3) unstable; urgency=low + + * upload to unstable + * [96c6727] add /var/cache/libvirt needed by qemuDriver for temporary + storage + * [794f95c] bump standards version to 3.8.0 + * [05184af] add README.source + + -- Guido Guenther Wed, 23 Jul 2008 11:30:31 -0400 + +libvirt (0.4.4-2) experimental; urgency=low + + * [facb983] README.Debian explain "default" network startup + * [395a510] add /var/lib/libvirt needed for the dnsmasq lease file + * [9c588ac] promote bridge-utils & dnsmasq to Recommends: since + they're needed for the default NAT network + * [9ed2cd4] recommend iptables - needed for the default NAT network + + -- Guido Guenther Wed, 23 Jul 2008 00:23:58 -0400 + +libvirt (0.4.4-1) experimental; urgency=low + + * [0ff1e68] new upstream version + * [2098f96] rebase patches for 0.4.4 + * [abbd15e] enable with-storage-disk now that we have parted1.8 + * [3942b25] start libvirtd by default + + -- Guido Guenther Fri, 27 Jun 2008 10:06:00 +0200 + +libvirt (0.4.4-0ubuntu1) intrepid; urgency=low + + * New upstream release + - Drop nic-model, disk-bus, and ancient_parted.patch. They're all + upstream now (in some form). + - Add new libdevmapper-dev build-dependency. + + -- Soren Hansen Wed, 25 Jun 2008 18:51:21 +0200 + +libvirt (0.4.2-6ubuntu1) UNRELEASED; urgency=low + + * Merge from debian unstable, remaining changes: + - debian/control: + + DebianMaintainerField + + Don't build-depend on QEmu. + + Add "XS-Original-" prefix to Debian's Vcs headers. + + Bump bridge-utils, dnsmasq-base, netcat-openbsd, and iptables to Depends + of libvirt-bin. + + s/interract/interact/g + - debian/libvirt-bin.default + + Make libvirtd start by default + - Add /var/lib/libvirt to libvirt-bin package. (dnsmasq needs it to store + its state info. + - Create /var/run/libvirt in libvirt-bin's init script. + - Rename libvirt group to libvirtd. + - Build iscsi and disk storage support. + - delayed_iff_up_bridge.patch: Don't try to bring up the bridge before at + least one interface has been added to it. + - dont_clobber_existing_bridges.patch: Assign the name of the virtual + bridge dynamically to avoid interfering with existing bridges. + - nic-model.patch: Add support for NIC configuration. + - disk-bus.patch: Add support for bus='foo' attributes for disk targets. + - better_default_uri_virsh.patch: Default to qemu:///system if the user + has write access to the libvirt socket, otherwise qemu:///session. + - ancient_parted.patch: Fix builds against libparted1.7 + - We call libxen-dev libxen3-dev, so change all references. + + -- Soren Hansen Wed, 25 Jun 2008 16:40:46 +0200 + +libvirt (0.4.2-6) unstable; urgency=low + + * reenable open-iscsi support - thanks to to the open-iscsi + maintainers for fixing this up + * build a libvirt0-dbg package + * register documentation with doc-base (Closes: #480294) - thanks to + Tzafrir Cohen for the patch + * control: fix typo + * README.Debian: explain debugging + + -- Guido Guenther Thu, 15 May 2008 18:04:20 +0200 + +libvirt (0.4.2-5ubuntu2) intrepid; urgency=low + + * We call libxen-dev libxen3-dev. + * Make libvirt-dev installable alongside libvirt0-dbg. + + -- Soren Hansen Fri, 02 May 2008 10:59:50 +0200 + +libvirt (0.4.2-5ubuntu1) intrepid; urgency=low + + * Merge from debian unstable, remaining changes: + - debian/control: + + DebianMaintainerField + + Don't build-depend on QEmu. + + Add "XS-Original-" prefix to Debian's Vcs headers. + + Bump bridge-utils, dnsmasq-base, netcat-openbsd, and iptables to Depends + of libvirt-bin. + + s/interract/interact/g + - Add libvirt0-dbg package + - debian/libvirt-bin.default + + Make libvirtd start by default + - Add /var/lib/libvirt to libvirt-bin package. (dnsmasq needs it to store + its state info. + - Create /var/run/libvirt in libvirt-bin's init script. + - Install PolicyKit and sasl stuff in libvirt-bin. + - Rename libvirt group to libvirtd. + - Build iscsi and disk storage support. + - delayed_iff_up_bridge.patch: Don't try to bring up the bridge before at + least one interface has been added to it. + - dont_clobber_existing_bridges.patch: Assign the name of the virtual + bridge dynamically to avoid interfering with existing bridges. + - nic-model.patch: Add support for NIC configuration. + - disk-bus.patch: Add support for bus='foo' attributes for disk targets. + - better_default_uri_virsh.patch: Default to qemu:///system if the user + has write access to the libvirt socket, otherwise qemu:///session. + - ancient_parted.patch: Fix builds against libparted1.7 + + -- Soren Hansen Fri, 02 May 2008 01:50:32 +0200 + +libvirt (0.4.2-5) unstable; urgency=low + + * no need to depend on python-all-dev we only build an extension for + the current python version + + -- Guido Guenther Tue, 22 Apr 2008 11:26:13 +0200 + +libvirt (0.4.2-4) unstable; urgency=low + + * only build-dep on qemu on architectures that have it + (Closes: #476290) + * the packages containing the daemon should suggest polkit + + -- Guido Guenther Fri, 18 Apr 2008 10:41:38 +0200 + +libvirt (0.4.2-3) unstable; urgency=low + + * drop the {build-,}dependency on open-iscsi too + * suggest policykit + + -- Guido Guenther Mon, 14 Apr 2008 15:27:20 +0200 + +libvirt (0.4.2-2) unstable; urgency=low + + * disable the iscsi storage backend until #423368 is fixed in unstable + * disable polkit authentication by default so the libvirt stays accessible + for members of the libvirt group + + -- Guido Guenther Mon, 14 Apr 2008 14:20:23 +0200 + +libvirt (0.4.2-1) unstable; urgency=low + + * drop no-mac.diff - applied upstream + * no need to explicitly link against libpthread + * always enable debugging + * add Homepage URL + * add Vcs-{Git,Browser} fields + * symlink devhelp docs + * enable policy kit + + -- Guido Guenther Fri, 11 Apr 2008 17:54:06 +0200 + +libvirt (0.4.1-1) experimental; urgency=low + + * new upstream version + * Xen 3.2 fixes + * storage pool support + * partition based storage pools are disabled, since this needs parted 1.8 + which is only in experimental + * update patches for new upstream release + * boot-dev-error.diff - applied upstream + * qemu-parse-error.diff - applied upstream + * qemu-path.diff - adjust to new hypervisor detection code + * rediff the rest + * new patches: + * no-mac.diff: don't set mac address on tun device since it breaks kvm + * bump shlibs version + + -- Guido Guenther Fri, 07 Mar 2008 10:17:21 +0100 + +libvirt (0.4.0-6) unstable; urgency=low + + * depend on libxen-dev (Closes:#467598) + * allow members of the libvirt group to manage virtual machines + + -- Guido Guenther Sun, 02 Mar 2008 16:11:49 +0100 + +libvirt (0.4.0-5) unstable; urgency=low + + * thanks to the xen maintainers Debian now has a working libxen-dev, so + enable xen support in the default build (Closes: #453826) + * recommend netcat-openbsd for unix domain socket support (Closes: #453627) + * README.Debian: document necessary xend options + * fix spelling of Python + + -- Guido Guenther Wed, 20 Feb 2008 11:14:22 +0100 + +libvirt (0.4.0-4) unstable; urgency=low + + * don't segfault on broken boot device configuration (Closes: #463686) + * don't segfault due to missing errorhandling in the XML parsing code + + -- Guido Guenther Tue, 05 Feb 2008 13:12:54 +0100 + +libvirt (0.4.0-3) unstable; urgency=low + + * add and remove the libvirt group for the socket + * be a bit more verbose on libvirtd reload + * depend on adduser since we add the libvirt user + * don't restart libvirtd on upgrades since it kills running qemus + * enable debugging via DEB_BUILD_OPTS + + -- Guido Guenther Sun, 03 Feb 2008 14:21:46 +0100 + +libvirt (0.4.0-2ubuntu8) hardy; urgency=low + + * disk-bus.patch: + - Add bus attribute to disk/target tags. Allows you to create virtio disks. + (LP: #213991) + * nic-model.patch: + - Add support to network interfaces. (LP: #213991) + * graceful_shutdown.patch: + - Rather than pulling the power from virtual machines, send an ACPI power + button event and let the OS handle it. + * better_default_uri_virsh.patch: + - Updated patch: Output connection URI to stderr instead of stdout to avoid + breaking scripts that use virsh. + + -- Soren Hansen Wed, 16 Apr 2008 10:35:03 +0200 + +libvirt (0.4.0-2ubuntu7) hardy; urgency=low + + * better_default_uri_virsh.patch: + - Make virsh connect to qemu:///system by default if the user has write + access to /var/run/libvirt/libvirt-sock and qemu:///session if not. + + -- Soren Hansen Tue, 01 Apr 2008 10:32:59 +0200 + +libvirt (0.4.0-2ubuntu6) hardy; urgency=low + + * *Actually* apply our patches to the -dbg version. + + -- Soren Hansen Tue, 11 Mar 2008 14:49:03 +0100 + +libvirt (0.4.0-2ubuntu5) hardy; urgency=low + + * Create /var/lib/libvirt in libvirt-bin. (LP: #191636) + + -- Soren Hansen Wed, 13 Feb 2008 22:17:33 +0100 + +libvirt (0.4.0-2ubuntu4) hardy; urgency=low + + * dont_clobber_existing_bridges.patch: + - Change bridge name from virbr0 to virbr%d, to ensure we never clobber + existing bridges. + * Add iptables dependency + + -- Soren Hansen Wed, 13 Feb 2008 00:53:20 +0100 + +libvirt (0.4.0-2ubuntu3) hardy; urgency=low + + * Build against libxen3-dev instead of libxen3.2-dev. + * libvirt-bin: + + Replace "Suggests: dnsmasq" with "Depends: dnsmasq-base". + + Add dependency on netcat-openbsd (to enable qemu+ssh:// style remote + management) + + -- Soren Hansen Fri, 08 Feb 2008 17:24:48 +0100 + +libvirt (0.4.0-2ubuntu2) hardy; urgency=low + + * Build against libxen-3.2 instead of 3.1. + * Bump bridge-utils from Suggests: to Depends:. + + -- Soren Hansen Tue, 05 Feb 2008 10:34:31 +0100 + +libvirt (0.4.0-2ubuntu1) hardy; urgency=low + + * Merge from debian unstable, remaining changes: + - DebianMaintainerField. + - Add libxen3.1-dev to enable Xen management. + - Add libpolkit-dbus-dev to enable polkit integration. + - Build libvirt0-dbg flavour. + - Start libvirtd by default. + - Install polkit policy. + - Install sasl config. + - Install sample qemu and libvirtd config. + - Create libvirtd group in postinst. + - libvirt-remote-ssh.patch: Fix foo+ssh:// urls. + - delayed_iff_up_bridge.patch: Don't try to IFF_UP the bridge interface + until an interface gets added to it. + * Create /var/run if it doesn't exist (LP: #178106). + + -- Soren Hansen Wed, 30 Jan 2008 16:43:11 +0100 + +libvirt (0.4.0-2) unstable; urgency=low + + * libvirt-bin.init: fix the reload target + * add configuration examples + + -- Guido Guenther Sat, 15 Dec 2007 18:59:11 +0100 + +libvirt (0.4.0-1) unstable; urgency=low + + * new upstream version + * enable sasl support + * leave policykit support disabled since it's not in unstable yet + * bump shlibs version + * remove CVS metadata + * rediff patches + * libvirtd-bin.init: libvirtd supports reload + + -- Guido Guenther Fri, 21 Dec 2007 16:49:13 +0100 + +libvirt (0.4.0-0ubuntu3) hardy; urgency=low + + * Clean up debian/rules (should reenable concurrent builds). + * Don't restart libvirt on upgrades (if there's a good reason, we'll + add it to postinst/prerm with checks for specific versions). + + -- Soren Hansen Fri, 18 Jan 2008 19:07:19 +0100 + +libvirt (0.4.0-0ubuntu2) hardy; urgency=low + + * IFF_UP'ing a bridge interface doesn't work until the first interface has + been added to it. + * Fix remote ssh connections. + + -- Soren Hansen Tue, 15 Jan 2008 10:53:25 +0100 + +libvirt (0.4.0-0ubuntu1) hardy; urgency=low + + * New upstream release. + * Don't change the default URI. It appears that too many applications + still depend on this broken behaviour. + * Change maintainer to ubuntu-core-dev. + + -- Soren Hansen Fri, 21 Dec 2007 11:24:02 +0100 + +libvirt (0.3.3-6ubuntu1) hardy; urgency=low + + * Merge from debian unstable, remaining changes: + - Add libvirt0-dbg package. + - Start libvirtd by default. + - Create libvirtd group, and have libvirtd's sockets have group ownership + "libvirtd". + - Add libxen as a build-dependency to enable libvirt's Xen features. + + -- Soren Hansen Thu, 20 Dec 2007 11:28:00 +0100 + +libvirt (0.3.3-6) unstable; urgency=low + + * don't include precompiled examples in the doc package (Closes: #456825) + * remove RHism from manpage (Closes: #455859) + * bump standards version + + -- Guido Guenther Wed, 19 Dec 2007 13:45:58 +0100 + +libvirt (0.3.3-5.xen0) unstable; urgency=low + + * rebuild with xen support + + -- Guido Guenther Tue, 08 Jan 2008 11:00:24 +0100 + +libvirt (0.3.3-5) unstable; urgency=low + + * make libs match overrides + * move to team maintenance + * suggest dnsmasq and bridge-utils for qemu networking + * remove stale PID files + + -- Guido Guenther Thu, 13 Dec 2007 21:34:16 +0100 + +libvirt (0.3.3-4.xen0) unstable; urgency=low + + * UNRELEASED + * build with xen support + * debian/control: we also support xen + + -- Guido Guenther Thu, 06 Dec 2007 15:43:03 +0100 + +libvirt (0.3.3-4ubuntu5) hardy; urgency=low + + * Made default_uri a configurable. + + -- Soren Hansen Wed, 19 Dec 2007 00:56:31 +0100 + +libvirt (0.3.3-4ubuntu4) hardy; urgency=low + + * Add "Provides: libvirt0" to libvirt0-dbg. + * Make virsh understand that the default URI is not xen:///. + + -- Soren Hansen Wed, 19 Dec 2007 00:13:10 +0100 + +libvirt (0.3.3-4ubuntu3) hardy; urgency=low + + * Change default URI to qemu:///session + * Add libvirt0-dbg package, which is just like libvirt0, but built + with --enable-debug=yes. + + -- Soren Hansen Thu, 13 Dec 2007 21:37:39 +0100 + +libvirt (0.3.3-4ubuntu2) hardy; urgency=low + + * Start libvirtd by default. + * Create libvirtd group, and have libvirtd's sockets have group ownership + "libvirtd". + + -- Soren Hansen Thu, 13 Dec 2007 15:08:29 +0100 + +libvirt (0.3.3-4ubuntu1) hardy; urgency=low + + * Fakesync with Debian. + * Reenable Xen. + + -- Soren Hansen Thu, 06 Dec 2007 13:33:13 +0100 + +libvirt (0.3.3-4) unstable; urgency=low + + * put packages into the proper sections + * fix messed up Standards-Version (Closes: #453900) + + -- Guido Guenther Sun, 02 Dec 2007 14:50:11 +0100 + +libvirt (0.3.3-3.xen0) unstable; urgency=low + + * build with xen support - depend on our hacked up xen-utils for that + + -- Guido Guenther Sat, 01 Dec 2007 16:27:32 +0000 + +libvirt (0.3.3-3) unstable; urgency=low + + * add initscript to start libvirtd + + -- Guido Guenther Wed, 28 Nov 2007 10:30:29 +0100 + +libvirt (0.3.3-2) unstable; urgency=low + + * debian/copyright: + * update FSF address + * update upstream author and copyright information + * install the virsh manpage + * use binary:Version instead of Source-Version + + -- Guido Guenther Fri, 23 Nov 2007 22:31:26 +0100 + +libvirt (0.3.3-1) unstable; urgency=low + + * repackage for Debian (Closes: #384300) + * enable avahi + * build with qemu/kvm support + * disable xen support until #402249 is fixed + * disable qemu autonetwork for now, causes libvirtd to seqfault + * fix path to kvm + * switch off DH_VERBOSE + * thanks to the Ubuntu maintainers for their work! + + -- Guido Guenther Fri, 23 Nov 2007 01:58:56 +0100 + +libvirt (0.3.3-0ubuntu1) hardy; urgency=low + + * New upstream release. + * Update maintainer. + + -- Soren Hansen Wed, 14 Nov 2007 23:09:33 +0100 + +libvirt (0.3.0-0ubuntu2) gutsy; urgency=low + + * Add lingnutls-dev Build-Dep. + + -- Fabio M. Di Nitto Mon, 16 Jul 2007 12:10:41 +0200 + +libvirt (0.3.0-0ubuntu1) gutsy; urgency=low + + * Import new upstram release that can actually build on xen-3.1. + + -- Fabio M. Di Nitto Mon, 16 Jul 2007 10:23:04 +0200 + +libvirt (0.2.2-0ubuntu1) gutsy; urgency=low + + * Depends on libxen3.1-dev. + + -- Chuck Short Fri, 13 Jul 2007 11:04:00 -0400 + +libvirt (0.2.2-0ubuntu0) gutsy; urgency=low + + * New upstream version. + * Updated libvirt-bin.install, thanks to Marcelo Boveto Shima. + + -- Chuck Short Sun, 24 Jun 2007 09:54:54 -0400 + +libvirt (0.1.8-0ubuntu2) feisty; urgency=low + + * Rebuild for python2.5 as the default python version. + + -- Matthias Klose Fri, 12 Jan 2007 13:21:55 +0000 + +libvirt (0.1.8-0ubuntu1) feisty; urgency=low + + * Initial release + + -- Andrew Mitchell Mon, 23 Oct 2006 20:00:28 +1300 + --- libvirt-0.4.6.orig/debian/copyright +++ libvirt-0.4.6/debian/copyright @@ -0,0 +1,44 @@ +libvirt was initially debianized by Andrew Mitchell + +It was downloaded from http://libvirt.org/sources/ + +Upstream Author: + + Daniel Veillard or + +Copyright: + + 2005,2006 Red Hat, Inc + +Licenses: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + + src/hash.c: + + Copyright (C) 2000 Bjorn Reese and Daniel Veillard. + + Permission to use, copy, modify, and distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED + WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF + MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND + CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER. + + +On Debian systems, the complete text of the GNU Lesser General +Public License can be found in `/usr/share/common-licenses/LGPL'. --- libvirt-0.4.6.orig/debian/control +++ libvirt-0.4.6/debian/control @@ -0,0 +1,90 @@ +Source: libvirt +Section: libs +Priority: optional +Maintainer: Ubuntu Core Developers +XSBC-Original-Maintainer: Debian Libvirt Maintainers +Uploaders: Guido Guenther +Build-Depends: cdbs (>= 0.4.43), debhelper (>= 5.0.38), libxml2-dev, libncurses5-dev, libreadline5-dev, zlib1g-dev, libgnutls-dev, python-dev (>= 2.3.5-11), python-central (>= 0.5.6), quilt, libavahi-client-dev, libsasl2-dev, libxen3-dev [i386 amd64], lvm2, libpolkit-dbus-dev, open-iscsi, libparted1.8-dev, libselinux1-dev +XS-Python-Version: current +XS-Debian-Vcs-Git: git://git.debian.org/git/pkg-libvirt/libvirt.git +XS-Debian-Vcs-Browser: http://git.debian.org/?p=pkg-libvirt/libvirt.git +Homepage: http://libvirt.org +Standards-Version: 3.8.0 + +Package: libvirt-bin +Architecture: any +Depends: ${shlibs:Depends}, libvirt0 (>= ${binary:Version}), bridge-utils, dnsmasq-base, netcat-openbsd, iptables, adduser +Enhances: qemu, kvm, xen +Section: admin +Recommends: kvm +Suggests: policykit +Description: the programs for the libvirt library + Libvirt is a C toolkit to interact with the virtualization capabilities + of recent versions of Linux (and other OSes). The library aims at providing + a long term stable C API for different virtualization mechanisms. It currently + supports QEMU, KVM, and XEN. + . + This package contains the supporting binaries to use with libvirt + +Package: libvirt0 +Architecture: any +Conflicts: libvirt0-dbg (<< 0.4.2-6ubuntu1) +Replaces: libvirt0-dbg (<< 0.4.2-6ubuntu1) +Depends: ${shlibs:Depends} +Recommends: lvm2 +Description: library for interfacing with different virtualization systems + Libvirt is a C toolkit to interact with the virtualization capabilities + of recent versions of Linux (and other OSes). The library aims at providing + a long term stable C API for different virtualization mechanisms. It currently + supports QEMU, KVM, and XEN. + +Package: libvirt0-dbg +Architecture: any +Depends: ${shlibs:Depends}, libvirt0 (= ${binary:Version}) +Priority: extra +Description: library for interfacing with different virtualization systems + Libvirt is a C toolkit to interact with the virtualization capabilities + of recent versions of Linux (and other OSes). The library aims at providing + a long term stable C API for different virtualization mechanisms. It currently + supports QEMU, KVM, and XEN. + . + This package contains the debugging symbols. + +Package: libvirt-doc +Architecture: all +Section: doc +Description: documentation for the libvirt library + Libvirt is a C toolkit to interact with the virtualization capabilities + of recent versions of Linux (and other OSes). The library aims at providing + a long term stable C API for different virtualization mechanisms. It currently + supports QEMU, KVM, and XEN. + . + This package contains the documentation. + +Package: libvirt-dev +Architecture: any +Section: libdevel +Depends: libvirt0 (= ${binary:Version}) , libxen3-dev [i386 amd64] +Description: development files for the libvirt library + Libvirt is a C toolkit to interact with the virtualization capabilities + of recent versions of Linux (and other OSes). The library aims at providing + a long term stable C API for different virtualization mechanisms. It currently + supports QEMU, KVM, and XEN. + . + This package contains the header files and static libraries which are + needed for developing the applications with libvirt. + +Package: python-libvirt +Architecture: any +Depends: ${shlibs:Depends}, ${python:Depends}, libvirt0 (>= ${binary:Version}) +Provides: ${python:Provides} +Section: python +XB-Python-Version: ${python:Versions} +Description: libvirt Python bindings + Libvirt is a C toolkit to interact with the virtualization capabilities + of recent versions of Linux (and other OSes). The library aims at providing + a long term stable C API for different virtualization mechanisms. It currently + supports QEMU, KVM, and XEN. + . + This package contains Python bindings for the libvirt library + --- libvirt-0.4.6.orig/debian/patches/0005-delayed_iff_up_bridge.patch +++ libvirt-0.4.6/debian/patches/0005-delayed_iff_up_bridge.patch @@ -0,0 +1,24 @@ +--- libvirt-0.4.0.orig/src/bridge.c ++++ libvirt-0.4.0/src/bridge.c +@@ -254,7 +254,10 @@ + const char *bridge, + const char *iface) + { +- return brAddDelInterface(ctl, SIOCBRADDIF, bridge, iface); ++ int ret; ++ if (ret = brAddDelInterface(ctl, SIOCBRADDIF, bridge, iface)) ++ return ret; ++ return brSetInterfaceUp(ctl, bridge, 1); + } + #else + int +@@ -413,7 +416,8 @@ + ifr.ifr_flags = flags; + + if (ioctl(ctl->fd, SIOCSIFFLAGS, &ifr) < 0) +- return errno; ++ /* Just smile and wave, boys... */ ++ return 0; + } + + return 0; --- libvirt-0.4.6.orig/debian/patches/0005-fix-define-vs.-defined-typos.patch +++ libvirt-0.4.6/debian/patches/0005-fix-define-vs.-defined-typos.patch @@ -0,0 +1,69 @@ +From 049aa77897ca49732101e39ccd63b6fc8a29a94c Mon Sep 17 00:00:00 2001 +From: Martin Michlmayr +Date: Fri, 14 Nov 2008 14:50:32 +0100 +Subject: [PATCH] fix #define vs. #defined typos + +affects non linux architectures and fixes the build with gcc 4.4 + +Closes: #505607 +--- + src/xen_internal.c | 8 ++++---- + src/xs_internal.c | 2 +- + 2 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/src/xen_internal.c b/src/xen_internal.c +index 3cfc5e3..d80ecfb 100644 +--- a/src/xen_internal.c ++++ b/src/xen_internal.c +@@ -73,7 +73,7 @@ typedef struct v1_hypercall_struct + #define XEN_V1_IOCTL_HYPERCALL_CMD \ + _IOC(_IOC_NONE, 'P', 0, sizeof(v1_hypercall_t)) + typedef v1_hypercall_t hypercall_t; +-#elif define(__sun__) ++#elif defined(__sun__) + typedef privcmd_hypercall_t hypercall_t; + #else + #error "unsupported platform" +@@ -338,7 +338,7 @@ lock_pages(void *addr, size_t len) + { + #ifdef __linux__ + return (mlock(addr, len)); +-#elif define(__sun) ++#elif defined(__sun) + return (0); + #endif + } +@@ -348,7 +348,7 @@ unlock_pages(void *addr, size_t len) + { + #ifdef __linux__ + return (munlock(addr, len)); +-#elif define(__sun) ++#elif defined(__sun) + return (0); + #endif + } +@@ -664,7 +664,7 @@ typedef struct xen_op_v2_dom xen_op_v2_dom; + #define XEN_HYPERVISOR_SOCKET "/proc/xen/privcmd" + #define HYPERVISOR_CAPABILITIES "/sys/hypervisor/properties/capabilities" + #define CPUINFO "/proc/cpuinfo" +-#elif define(__sun__) ++#elif defined(__sun__) + #define XEN_HYPERVISOR_SOCKET "/dev/xen/privcmd" + #define HYPERVISOR_CAPABILITIES "" + #define CPUINFO "/dev/cpu/self/cpuid" +diff --git a/src/xs_internal.c b/src/xs_internal.c +index 316604a..3cb67db 100644 +--- a/src/xs_internal.c ++++ b/src/xs_internal.c +@@ -34,7 +34,7 @@ + + #ifdef __linux__ + #define XEN_HYPERVISOR_SOCKET "/proc/xen/privcmd" +-#elif define(__sun__) ++#elif defined(__sun__) + #define XEN_HYPERVISOR_SOCKET "/dev/xen/privcmd" + #else + #error "unsupported platform" +-- +1.6.0.3 + --- libvirt-0.4.6.orig/debian/patches/0002-qemu-disable-network.diff.patch +++ libvirt-0.4.6/debian/patches/0002-qemu-disable-network.diff.patch @@ -0,0 +1,41 @@ +From f7cfb3813be36f8178392e0d313935d4fd97e49a Mon Sep 17 00:00:00 2001 +From: Guido Guenther +Date: Fri, 7 Mar 2008 09:08:26 +0100 +Subject: [PATCH] qemu-disable-network.diff + +--- + qemud/Makefile.am | 3 --- + qemud/Makefile.in | 3 --- + 2 files changed, 0 insertions(+), 6 deletions(-) + +diff --git a/qemud/Makefile.am b/qemud/Makefile.am +index 5d6ff63..29ff58c 100644 +--- a/qemud/Makefile.am ++++ b/qemud/Makefile.am +@@ -107,9 +107,6 @@ install-data-local: install-init install-data-sasl install-data-polkit + $(DESTDIR)$(sysconfdir)/$(default_xml_dest) + sed -i -e "s,,\n $(UUID)," \ + $(DESTDIR)$(sysconfdir)/$(default_xml_dest) +- test -e $(DESTDIR)$(sysconfdir)/libvirt/qemu/networks/autostart/default.xml || \ +- ln -s ../default.xml \ +- $(DESTDIR)$(sysconfdir)/libvirt/qemu/networks/autostart/default.xml + mkdir -p $(DESTDIR)$(localstatedir)/log/libvirt/qemu + mkdir -p $(DESTDIR)$(localstatedir)/run/libvirt + mkdir -p $(DESTDIR)$(localstatedir)/lib/libvirt +diff --git a/qemud/Makefile.in b/qemud/Makefile.in +index 6b7cefe..7293b86 100644 +--- a/qemud/Makefile.in ++++ b/qemud/Makefile.in +@@ -1092,9 +1092,6 @@ remote_protocol.c: remote_protocol.h + @WITH_LIBVIRTD_TRUE@ $(DESTDIR)$(sysconfdir)/$(default_xml_dest) + @WITH_LIBVIRTD_TRUE@ sed -i -e "s,,\n $(UUID)," \ + @WITH_LIBVIRTD_TRUE@ $(DESTDIR)$(sysconfdir)/$(default_xml_dest) +-@WITH_LIBVIRTD_TRUE@ test -e $(DESTDIR)$(sysconfdir)/libvirt/qemu/networks/autostart/default.xml || \ +-@WITH_LIBVIRTD_TRUE@ ln -s ../default.xml \ +-@WITH_LIBVIRTD_TRUE@ $(DESTDIR)$(sysconfdir)/libvirt/qemu/networks/autostart/default.xml + @WITH_LIBVIRTD_TRUE@ mkdir -p $(DESTDIR)$(localstatedir)/log/libvirt/qemu + @WITH_LIBVIRTD_TRUE@ mkdir -p $(DESTDIR)$(localstatedir)/run/libvirt + @WITH_LIBVIRTD_TRUE@ mkdir -p $(DESTDIR)$(localstatedir)/lib/libvirt +-- +1.5.6.5 + --- libvirt-0.4.6.orig/debian/patches/0007-better_default_uri_virsh.patch +++ libvirt-0.4.6/debian/patches/0007-better_default_uri_virsh.patch @@ -0,0 +1,29 @@ +Index: libvirt-0.4.2-5ubuntu1/src/virsh.c +=================================================================== +--- libvirt-0.4.2-5ubuntu1.orig/src/virsh.c 2008-05-01 03:07:34.000000000 +0200 ++++ libvirt-0.4.2-5ubuntu1/src/virsh.c 2008-05-01 22:50:36.403798885 +0200 +@@ -63,6 +63,8 @@ + #define VSH_PROMPT_RW "virsh # " + #define VSH_PROMPT_RO "virsh > " + ++#include "remote_internal.h" ++ + #define GETTIMEOFDAY(T) gettimeofday(T, NULL) + #define DIFF_MSEC(T, U) \ + ((((int) ((T)->tv_sec - (U)->tv_sec)) * 1000000.0 + \ +@@ -6566,8 +6568,15 @@ + + if ((defaultConn = getenv("VIRSH_DEFAULT_CONNECT_URI"))) { + ctl->name = strdup(defaultConn); ++ } else if (!access(LIBVIRTD_PRIV_UNIX_SOCKET, W_OK)) { ++ ctl->name = strdup("qemu:///system"); ++ } else { ++ ctl->name = strdup("qemu:///session"); + } + ++ if (!ctl->quiet) ++ fprintf(stderr, _("Connecting to uri: %s\n"), ctl->name); ++ + if (!vshParseArgv(ctl, argc, argv)) { + vshDeinit(ctl); + exit(EXIT_FAILURE); --- libvirt-0.4.6.orig/debian/patches/0008-lp287533.patch +++ libvirt-0.4.6/debian/patches/0008-lp287533.patch @@ -0,0 +1,19 @@ +# +# https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/287533 +# Description: allow 16 VCPUs when using kvm +# +diff -Nur libvirt-0.4.4/src/qemu_driver.c libvirt-0.4.4.new/src/qemu_driver.c +--- libvirt-0.4.4/src/qemu_driver.c 2008-10-22 10:09:30.000000000 -0500 ++++ libvirt-0.4.4.new/src/qemu_driver.c 2008-10-22 10:10:54.000000000 -0500 +@@ -1746,7 +1746,10 @@ + /* XXX future KVM will support SMP. Need to probe + kernel to figure out KVM module version i guess */ + if (STRCASEEQ(type, "kvm")) +- return 1; ++ /* Ubuntu supports up to 16 VCPUs now ++ * https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/287533 ++ */ ++ return 16; + + if (STRCASEEQ(type, "kqemu")) + return 1; --- libvirt-0.4.6.orig/debian/patches/0006-dont_clobber_existing_bridges.patch +++ libvirt-0.4.6/debian/patches/0006-dont_clobber_existing_bridges.patch @@ -0,0 +1,12 @@ +Index: ubuntu/qemud/default-network.xml +=================================================================== +--- ubuntu.orig/qemud/default-network.xml 2008-02-12 01:20:09.818288028 +0100 ++++ ubuntu/qemud/default-network.xml 2008-02-12 01:20:17.518258142 +0100 +@@ -1,6 +1,6 @@ + + default +- ++ + + + --- libvirt-0.4.6.orig/debian/patches/0001-remove-RHism.diff.patch +++ libvirt-0.4.6/debian/patches/0001-remove-RHism.diff.patch @@ -0,0 +1,25 @@ +From dd53d550311316241c3999ff5573ab88d9825319 Mon Sep 17 00:00:00 2001 +From: Guido Guenther +Date: Fri, 7 Mar 2008 09:08:25 +0100 +Subject: [PATCH] remove-RHism.diff + +--- + virsh.1 | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/virsh.1 b/virsh.1 +index 063dde7..751c6aa 100644 +--- a/virsh.1 ++++ b/virsh.1 +@@ -164,7 +164,7 @@ the program. + .IX Header "NOTES" + All \fBvirsh\fR operations rely upon the libvirt library. + For any virsh commands to run xend/qemu, or what ever virtual library that libvirt supports. For this reason you should start xend/qemu as a service when your system first boots using xen/qemu. This can usually be done using the command +-\&\fBservice start libvirtd\fR . ++\&\fB/etc/init.d/libvirt-bin start\fR . + .PP + Most \fBvirsh\fR commands require root privileges to run due to the + communications channels used to talk to the hypervisor. Running as +-- +1.5.6.5 + --- libvirt-0.4.6.orig/debian/patches/0004-support-virtio-and-scsi-disks-in-qemudDomainBlockSta.patch +++ libvirt-0.4.6/debian/patches/0004-support-virtio-and-scsi-disks-in-qemudDomainBlockSta.patch @@ -0,0 +1,38 @@ +From b52ad525b45385d20a827becc055621c70a12b3b Mon Sep 17 00:00:00 2001 +From: Guido Guenther +Date: Thu, 2 Oct 2008 21:12:20 +0200 +Subject: [PATCH] support virtio and scsi disks in qemudDomainBlockStats + +--- + src/qemu_driver.c | 8 ++++++++ + 1 files changed, 8 insertions(+), 0 deletions(-) + +diff --git a/src/qemu_driver.c b/src/qemu_driver.c +index 9d8f75a..58530aa 100644 +--- a/src/qemu_driver.c ++++ b/src/qemu_driver.c +@@ -3416,6 +3416,8 @@ qemudDomainBlockStats (virDomainPtr dom, + * hd[a-] to ide0-hd[0-] + * cdrom to ide1-cd0 + * fd[a-] to floppy[0-] ++ * vd[a-] to virtio[0-] ++ * sd[a-] to scsi0-hd[0-] + */ + if (STRPREFIX (path, "hd") && c_islower(path[2])) + snprintf (qemu_dev_name, sizeof (qemu_dev_name), +@@ -3425,6 +3427,12 @@ qemudDomainBlockStats (virDomainPtr dom, + else if (STRPREFIX (path, "fd") && c_islower(path[2])) + snprintf (qemu_dev_name, sizeof (qemu_dev_name), + "floppy%d", path[2] - 'a'); ++ else if (STRPREFIX (path, "vd") && c_islower(path[2])) ++ snprintf (qemu_dev_name, sizeof (qemu_dev_name), ++ "virtio%d", path[2] - 'a'); ++ else if (STRPREFIX (path, "sd") && c_islower(path[2])) ++ snprintf (qemu_dev_name, sizeof (qemu_dev_name), ++ "scsi0-hd%d", path[2] - 'a'); + else { + qemudReportError (dom->conn, dom, NULL, VIR_ERR_INVALID_ARG, + _("invalid path: %s"), path); +-- +1.6.0.1 + --- libvirt-0.4.6.orig/debian/patches/0003-allow-libvirt-group-to-access-the-socket.patch +++ libvirt-0.4.6/debian/patches/0003-allow-libvirt-group-to-access-the-socket.patch @@ -0,0 +1,49 @@ +From 1dcda30d8561d13c6f6aa18c98a0403990033d35 Mon Sep 17 00:00:00 2001 +From: Guido Guenther +Date: Thu, 26 Jun 2008 20:01:38 +0200 +Subject: [PATCH] allow libvirt group to access the socket + +--- + qemud/libvirtd.conf | 8 ++++---- + 1 files changed, 4 insertions(+), 4 deletions(-) + +Index: libvirt-0.4.6-5ubuntu1/qemud/libvirtd.conf +=================================================================== +--- libvirt-0.4.6-5ubuntu1.orig/qemud/libvirtd.conf 2008-11-14 23:48:00.000000000 +0100 ++++ libvirt-0.4.6-5ubuntu1/qemud/libvirtd.conf 2008-11-18 12:53:16.017690455 +0100 +@@ -75,7 +75,7 @@ + # without becoming root. + # + # This is restricted to 'root' by default. +-#unix_sock_group = "libvirt" ++unix_sock_group = "libvirtd" + + # Set the UNIX socket permissions for the R/O socket. This is used + # for monitoring VM status only +@@ -92,7 +92,7 @@ + # + # If not using PolicyKit and setting group ownership for access + # control then you may want to relax this to: +-#unix_sock_rw_perms = "0770" ++unix_sock_rw_perms = "0770" + + + +@@ -122,7 +122,7 @@ + # + # To restrict monitoring of domains you may wish to enable + # an authentication mechanism here +-#auth_unix_ro = "none" ++auth_unix_ro = "none" + + # Set an authentication scheme for UNIX read-write sockets + # By default socket permissions only allow root. If PolicyKit +@@ -131,7 +131,7 @@ + # + # If the unix_sock_rw_perms are changed you may wish to enable + # an authentication mechanism here +-#auth_unix_rw = "none" ++auth_unix_rw = "none" + + # Change the authentication scheme for TCP sockets. + # --- libvirt-0.4.6.orig/debian/patches/series +++ libvirt-0.4.6/debian/patches/series @@ -0,0 +1,10 @@ +0001-remove-RHism.diff.patch +#0002-qemu-disable-network.diff.patch +0003-allow-libvirt-group-to-access-the-socket.patch +0004-support-virtio-and-scsi-disks-in-qemudDomainBlockSta.patch +0005-fix-define-vs.-defined-typos.patch +0005-delayed_iff_up_bridge.patch +0006-dont_clobber_existing_bridges.patch +0007-better_default_uri_virsh.patch +qemu_migration.patch +dynamic_bridge_names.patch --- libvirt-0.4.6.orig/debian/patches/dynamic_bridge_names.patch +++ libvirt-0.4.6/debian/patches/dynamic_bridge_names.patch @@ -0,0 +1,36 @@ +Index: libvirt-0.4.6-5ubuntu1/src/bridge.c +=================================================================== +--- libvirt-0.4.6-5ubuntu1.orig/src/bridge.c 2008-11-18 14:51:45.184583106 +0100 ++++ libvirt-0.4.6-5ubuntu1/src/bridge.c 2008-11-18 14:56:24.377255498 +0100 +@@ -120,7 +120,13 @@ + * @name: the bridge name + * + * This function register a new bridge ++ * This function registers a new bridge, @name can be either: ++ * - a fixed name ++ * - a name template with '%d' for dynamic name allocation ++ * - an empty string which will be treated like "virbr%d" + * ++ * In either case the final name for the bridge will be stored in @name. ++* + * Returns 0 in case of success or an errno code in case of failure. + */ + #ifdef SIOCBRADDBR +@@ -131,7 +137,7 @@ + if (!ctl || !ctl->fd || !name) + return EINVAL; + +- if (*name) { ++ if (*name && !strstr(*name, "%d")) { + if (ioctl(ctl->fd, SIOCBRADDBR, *name) == 0) + return 0; + } else { +@@ -139,7 +145,7 @@ + do { + char try[50]; + +- snprintf(try, sizeof(try), "virbr%d", id); ++ snprintf(try, sizeof(try), *name ? *name : "virbr%d", id); + + if (ioctl(ctl->fd, SIOCBRADDBR, try) == 0) { + if (!(*name = strdup(try))) { --- libvirt-0.4.6.orig/debian/patches/qemu_migration.patch +++ libvirt-0.4.6/debian/patches/qemu_migration.patch @@ -0,0 +1,1192 @@ +From: Daniel Veillard +Date: Fri, 14 Nov 2008 08:42:47 +0000 (+0000) +Subject: KVM/QEmu migration support +X-Git-Url: http://git.et.redhat.com/?p=libvirt.git;a=commitdiff_plain;h=0ef0ee26240a39ef6d557b8f9ba1c48da4cfc749 + +KVM/QEmu migration support +* qemud/remote.c qemud/remote_dispatch_localvars.h + qemud/remote_dispatch_proc_switch.h qemud/remote_dispatch_prototypes.h + qemud/remote_protocol.c qemud/remote_protocol.h + qemud/remote_protocol.x src/driver.h src/libvirt.c + src/libvirt_internal.h src/libvirt_sym.version src/lxc_driver.c + src/openvz_driver.c src/qemu_conf.h src/qemu_driver.c + src/remote_internal.c src/test.c src/virsh.c: large patch to + add migration support for KVM/QEmu, based on the work of Rich Jones + and Chris Lalancette. This introduce a new version of the prepare + and finish steps of the migration, so changes the driver API and + a lot of code. +Daniel +--- + +Index: libvirt-0.4.6-5ubuntu1/ChangeLog +=================================================================== +--- libvirt-0.4.6-5ubuntu1.orig/ChangeLog 2008-11-18 14:58:19.308586714 +0100 ++++ libvirt-0.4.6-5ubuntu1/ChangeLog 2008-11-18 16:58:41.828583809 +0100 +@@ -1,3 +1,16 @@ ++Fri Nov 14 09:38:22 CET 2008 Daniel Veillard ++ ++ * qemud/remote.c qemud/remote_dispatch_localvars.h ++ qemud/remote_dispatch_proc_switch.h qemud/remote_dispatch_prototypes.h ++ qemud/remote_protocol.c qemud/remote_protocol.h ++ qemud/remote_protocol.x src/driver.h src/libvirt.c ++ src/libvirt_internal.h src/libvirt_sym.version src/lxc_driver.c ++ src/openvz_driver.c src/qemu_conf.h src/qemu_driver.c ++ src/remote_internal.c src/test.c src/virsh.c: large patch to ++ add migration support for KVM/QEmu, based on the work of Rich Jones ++ and Chris Lalancette. This introduce a new version of the prepare ++ and finish steps of the migration, so changes the driver API and ++ a lot of code. + Tue Sep 23 22:45:47 CEST 2008 Daniel Veillard + + * configure.in libvirt.spec.in NEWS docs/*: release of libvirt-0.4.6 +Index: libvirt-0.4.6-5ubuntu1/qemud/remote.c +=================================================================== +--- libvirt-0.4.6-5ubuntu1.orig/qemud/remote.c 2008-11-18 14:58:19.328584926 +0100 ++++ libvirt-0.4.6-5ubuntu1/qemud/remote.c 2008-11-18 16:58:41.896583443 +0100 +@@ -1458,6 +1458,69 @@ + } + + static int ++remoteDispatchDomainMigratePrepare2 (struct qemud_server *server ATTRIBUTE_UNUSED, ++ struct qemud_client *client, ++ remote_message_header *req, ++ remote_domain_migrate_prepare2_args *args, ++ remote_domain_migrate_prepare2_ret *ret) ++{ ++ int r; ++ char *cookie = NULL; ++ int cookielen = 0; ++ char *uri_in; ++ char **uri_out; ++ char *dname; ++ CHECK_CONN (client); ++ ++ uri_in = args->uri_in == NULL ? NULL : *args->uri_in; ++ dname = args->dname == NULL ? NULL : *args->dname; ++ ++ /* Wacky world of XDR ... */ ++ if (VIR_ALLOC(uri_out) < 0) { ++ remoteDispatchSendError(client, req, VIR_ERR_NO_MEMORY, NULL); ++ return -2; ++ } ++ ++ r = __virDomainMigratePrepare2 (client->conn, &cookie, &cookielen, ++ uri_in, uri_out, ++ args->flags, dname, args->resource, ++ args->dom_xml); ++ if (r == -1) return -1; ++ ++ /* remoteDispatchClientRequest will free cookie, uri_out and ++ * the string if there is one. ++ */ ++ ret->cookie.cookie_len = cookielen; ++ ret->cookie.cookie_val = cookie; ++ ret->uri_out = *uri_out == NULL ? NULL : uri_out; ++ ++ return 0; ++} ++ ++static int ++remoteDispatchDomainMigrateFinish2 (struct qemud_server *server ATTRIBUTE_UNUSED, ++ struct qemud_client *client, ++ remote_message_header *req, ++ remote_domain_migrate_finish2_args *args, ++ remote_domain_migrate_finish2_ret *ret) ++{ ++ virDomainPtr ddom; ++ CHECK_CONN (client); ++ ++ ddom = __virDomainMigrateFinish2 (client->conn, args->dname, ++ args->cookie.cookie_val, ++ args->cookie.cookie_len, ++ args->uri, ++ args->flags, ++ args->retcode); ++ if (ddom == NULL) return -1; ++ ++ make_nonnull_domain (&ret->ddom, ddom); ++ ++ return 0; ++} ++ ++static int + remoteDispatchListDefinedDomains (struct qemud_server *server ATTRIBUTE_UNUSED, + struct qemud_client *client, + remote_message_header *req, +Index: libvirt-0.4.6-5ubuntu1/qemud/remote_dispatch_localvars.h +=================================================================== +--- libvirt-0.4.6-5ubuntu1.orig/qemud/remote_dispatch_localvars.h 2008-11-18 14:58:19.348583138 +0100 ++++ libvirt-0.4.6-5ubuntu1/qemud/remote_dispatch_localvars.h 2008-11-18 16:58:41.916582214 +0100 +@@ -127,10 +127,14 @@ + remote_list_networks_args lv_remote_list_networks_args; + remote_list_networks_ret lv_remote_list_networks_ret; + remote_storage_pool_undefine_args lv_remote_storage_pool_undefine_args; ++remote_domain_migrate_finish2_args lv_remote_domain_migrate_finish2_args; ++remote_domain_migrate_finish2_ret lv_remote_domain_migrate_finish2_ret; + remote_domain_set_autostart_args lv_remote_domain_set_autostart_args; + remote_storage_pool_get_autostart_args lv_remote_storage_pool_get_autostart_args; + remote_storage_pool_get_autostart_ret lv_remote_storage_pool_get_autostart_ret; + remote_node_get_free_memory_ret lv_remote_node_get_free_memory_ret; ++remote_domain_migrate_prepare2_args lv_remote_domain_migrate_prepare2_args; ++remote_domain_migrate_prepare2_ret lv_remote_domain_migrate_prepare2_ret; + remote_storage_vol_get_path_args lv_remote_storage_vol_get_path_args; + remote_storage_vol_get_path_ret lv_remote_storage_vol_get_path_ret; + remote_domain_lookup_by_id_args lv_remote_domain_lookup_by_id_args; +Index: libvirt-0.4.6-5ubuntu1/qemud/remote_dispatch_proc_switch.h +=================================================================== +--- libvirt-0.4.6-5ubuntu1.orig/qemud/remote_dispatch_proc_switch.h 2008-11-18 14:58:19.368610544 +0100 ++++ libvirt-0.4.6-5ubuntu1/qemud/remote_dispatch_proc_switch.h 2008-11-18 16:58:41.956582339 +0100 +@@ -242,6 +242,15 @@ + ret = (char *) &lv_remote_domain_migrate_finish_ret; + memset (&lv_remote_domain_migrate_finish_ret, 0, sizeof lv_remote_domain_migrate_finish_ret); + break; ++case REMOTE_PROC_DOMAIN_MIGRATE_FINISH2: ++ fn = (dispatch_fn) remoteDispatchDomainMigrateFinish2; ++ args_filter = (xdrproc_t) xdr_remote_domain_migrate_finish2_args; ++ args = (char *) &lv_remote_domain_migrate_finish2_args; ++ memset (&lv_remote_domain_migrate_finish2_args, 0, sizeof lv_remote_domain_migrate_finish2_args); ++ ret_filter = (xdrproc_t) xdr_remote_domain_migrate_finish2_ret; ++ ret = (char *) &lv_remote_domain_migrate_finish2_ret; ++ memset (&lv_remote_domain_migrate_finish2_ret, 0, sizeof lv_remote_domain_migrate_finish2_ret); ++ break; + case REMOTE_PROC_DOMAIN_MIGRATE_PERFORM: + fn = (dispatch_fn) remoteDispatchDomainMigratePerform; + args_filter = (xdrproc_t) xdr_remote_domain_migrate_perform_args; +@@ -257,6 +266,15 @@ + ret = (char *) &lv_remote_domain_migrate_prepare_ret; + memset (&lv_remote_domain_migrate_prepare_ret, 0, sizeof lv_remote_domain_migrate_prepare_ret); + break; ++case REMOTE_PROC_DOMAIN_MIGRATE_PREPARE2: ++ fn = (dispatch_fn) remoteDispatchDomainMigratePrepare2; ++ args_filter = (xdrproc_t) xdr_remote_domain_migrate_prepare2_args; ++ args = (char *) &lv_remote_domain_migrate_prepare2_args; ++ memset (&lv_remote_domain_migrate_prepare2_args, 0, sizeof lv_remote_domain_migrate_prepare2_args); ++ ret_filter = (xdrproc_t) xdr_remote_domain_migrate_prepare2_ret; ++ ret = (char *) &lv_remote_domain_migrate_prepare2_ret; ++ memset (&lv_remote_domain_migrate_prepare2_ret, 0, sizeof lv_remote_domain_migrate_prepare2_ret); ++ break; + case REMOTE_PROC_DOMAIN_PIN_VCPU: + fn = (dispatch_fn) remoteDispatchDomainPinVcpu; + args_filter = (xdrproc_t) xdr_remote_domain_pin_vcpu_args; +Index: libvirt-0.4.6-5ubuntu1/qemud/remote_dispatch_prototypes.h +=================================================================== +--- libvirt-0.4.6-5ubuntu1.orig/qemud/remote_dispatch_prototypes.h 2008-11-18 14:58:19.384585410 +0100 ++++ libvirt-0.4.6-5ubuntu1/qemud/remote_dispatch_prototypes.h 2008-11-18 16:58:41.972582278 +0100 +@@ -32,8 +32,10 @@ + static int remoteDispatchDomainLookupByUuid (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_lookup_by_uuid_args *args, remote_domain_lookup_by_uuid_ret *ret); + static int remoteDispatchDomainMemoryPeek (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_memory_peek_args *args, remote_domain_memory_peek_ret *ret); + static int remoteDispatchDomainMigrateFinish (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_migrate_finish_args *args, remote_domain_migrate_finish_ret *ret); ++static int remoteDispatchDomainMigrateFinish2 (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_migrate_finish2_args *args, remote_domain_migrate_finish2_ret *ret); + static int remoteDispatchDomainMigratePerform (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_migrate_perform_args *args, void *ret); + static int remoteDispatchDomainMigratePrepare (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_migrate_prepare_args *args, remote_domain_migrate_prepare_ret *ret); ++static int remoteDispatchDomainMigratePrepare2 (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_migrate_prepare2_args *args, remote_domain_migrate_prepare2_ret *ret); + static int remoteDispatchDomainPinVcpu (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_pin_vcpu_args *args, void *ret); + static int remoteDispatchDomainReboot (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_reboot_args *args, void *ret); + static int remoteDispatchDomainRestore (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_restore_args *args, void *ret); +Index: libvirt-0.4.6-5ubuntu1/qemud/remote_protocol.c +=================================================================== +--- libvirt-0.4.6-5ubuntu1.orig/qemud/remote_protocol.c 2008-11-18 14:58:19.396584491 +0100 ++++ libvirt-0.4.6-5ubuntu1/qemud/remote_protocol.c 2008-11-18 16:58:41.988582077 +0100 +@@ -948,6 +948,62 @@ + } + + bool_t ++xdr_remote_domain_migrate_prepare2_args (XDR *xdrs, remote_domain_migrate_prepare2_args *objp) ++{ ++ ++ if (!xdr_remote_string (xdrs, &objp->uri_in)) ++ return FALSE; ++ if (!xdr_u_quad_t (xdrs, &objp->flags)) ++ return FALSE; ++ if (!xdr_remote_string (xdrs, &objp->dname)) ++ return FALSE; ++ if (!xdr_u_quad_t (xdrs, &objp->resource)) ++ return FALSE; ++ if (!xdr_remote_nonnull_string (xdrs, &objp->dom_xml)) ++ return FALSE; ++ return TRUE; ++} ++ ++bool_t ++xdr_remote_domain_migrate_prepare2_ret (XDR *xdrs, remote_domain_migrate_prepare2_ret *objp) ++{ ++ char **objp_cpp0 = (char **) (void *) &objp->cookie.cookie_val; ++ ++ if (!xdr_bytes (xdrs, objp_cpp0, (u_int *) &objp->cookie.cookie_len, REMOTE_MIGRATE_COOKIE_MAX)) ++ return FALSE; ++ if (!xdr_remote_string (xdrs, &objp->uri_out)) ++ return FALSE; ++ return TRUE; ++} ++ ++bool_t ++xdr_remote_domain_migrate_finish2_args (XDR *xdrs, remote_domain_migrate_finish2_args *objp) ++{ ++ char **objp_cpp0 = (char **) (void *) &objp->cookie.cookie_val; ++ ++ if (!xdr_remote_nonnull_string (xdrs, &objp->dname)) ++ return FALSE; ++ if (!xdr_bytes (xdrs, objp_cpp0, (u_int *) &objp->cookie.cookie_len, REMOTE_MIGRATE_COOKIE_MAX)) ++ return FALSE; ++ if (!xdr_remote_nonnull_string (xdrs, &objp->uri)) ++ return FALSE; ++ if (!xdr_u_quad_t (xdrs, &objp->flags)) ++ return FALSE; ++ if (!xdr_int (xdrs, &objp->retcode)) ++ return FALSE; ++ return TRUE; ++} ++ ++bool_t ++xdr_remote_domain_migrate_finish2_ret (XDR *xdrs, remote_domain_migrate_finish2_ret *objp) ++{ ++ ++ if (!xdr_remote_nonnull_domain (xdrs, &objp->ddom)) ++ return FALSE; ++ return TRUE; ++} ++ ++bool_t + xdr_remote_list_defined_domains_args (XDR *xdrs, remote_list_defined_domains_args *objp) + { + +Index: libvirt-0.4.6-5ubuntu1/qemud/remote_protocol.h +=================================================================== +--- libvirt-0.4.6-5ubuntu1.orig/qemud/remote_protocol.h 2008-11-18 14:58:19.412582543 +0100 ++++ libvirt-0.4.6-5ubuntu1/qemud/remote_protocol.h 2008-11-18 16:58:41.996584560 +0100 +@@ -506,6 +506,41 @@ + }; + typedef struct remote_domain_migrate_finish_ret remote_domain_migrate_finish_ret; + ++struct remote_domain_migrate_prepare2_args { ++ remote_string uri_in; ++ u_quad_t flags; ++ remote_string dname; ++ u_quad_t resource; ++ remote_nonnull_string dom_xml; ++}; ++typedef struct remote_domain_migrate_prepare2_args remote_domain_migrate_prepare2_args; ++ ++struct remote_domain_migrate_prepare2_ret { ++ struct { ++ u_int cookie_len; ++ char *cookie_val; ++ } cookie; ++ remote_string uri_out; ++}; ++typedef struct remote_domain_migrate_prepare2_ret remote_domain_migrate_prepare2_ret; ++ ++struct remote_domain_migrate_finish2_args { ++ remote_nonnull_string dname; ++ struct { ++ u_int cookie_len; ++ char *cookie_val; ++ } cookie; ++ remote_nonnull_string uri; ++ u_quad_t flags; ++ int retcode; ++}; ++typedef struct remote_domain_migrate_finish2_args remote_domain_migrate_finish2_args; ++ ++struct remote_domain_migrate_finish2_ret { ++ remote_nonnull_domain ddom; ++}; ++typedef struct remote_domain_migrate_finish2_ret remote_domain_migrate_finish2_ret; ++ + struct remote_list_defined_domains_args { + int maxnames; + }; +@@ -1189,6 +1224,8 @@ + REMOTE_PROC_NODE_GET_FREE_MEMORY = 102, + REMOTE_PROC_DOMAIN_BLOCK_PEEK = 103, + REMOTE_PROC_DOMAIN_MEMORY_PEEK = 104, ++ REMOTE_PROC_DOMAIN_MIGRATE_PREPARE2 = 108, ++ REMOTE_PROC_DOMAIN_MIGRATE_FINISH2 = 109, + }; + typedef enum remote_procedure remote_procedure; + +@@ -1295,6 +1332,10 @@ + extern bool_t xdr_remote_domain_migrate_perform_args (XDR *, remote_domain_migrate_perform_args*); + extern bool_t xdr_remote_domain_migrate_finish_args (XDR *, remote_domain_migrate_finish_args*); + extern bool_t xdr_remote_domain_migrate_finish_ret (XDR *, remote_domain_migrate_finish_ret*); ++extern bool_t xdr_remote_domain_migrate_prepare2_args (XDR *, remote_domain_migrate_prepare2_args*); ++extern bool_t xdr_remote_domain_migrate_prepare2_ret (XDR *, remote_domain_migrate_prepare2_ret*); ++extern bool_t xdr_remote_domain_migrate_finish2_args (XDR *, remote_domain_migrate_finish2_args*); ++extern bool_t xdr_remote_domain_migrate_finish2_ret (XDR *, remote_domain_migrate_finish2_ret*); + extern bool_t xdr_remote_list_defined_domains_args (XDR *, remote_list_defined_domains_args*); + extern bool_t xdr_remote_list_defined_domains_ret (XDR *, remote_list_defined_domains_ret*); + extern bool_t xdr_remote_num_of_defined_domains_ret (XDR *, remote_num_of_defined_domains_ret*); +@@ -1476,6 +1517,10 @@ + extern bool_t xdr_remote_domain_migrate_perform_args (); + extern bool_t xdr_remote_domain_migrate_finish_args (); + extern bool_t xdr_remote_domain_migrate_finish_ret (); ++extern bool_t xdr_remote_domain_migrate_prepare2_args (); ++extern bool_t xdr_remote_domain_migrate_prepare2_ret (); ++extern bool_t xdr_remote_domain_migrate_finish2_args (); ++extern bool_t xdr_remote_domain_migrate_finish2_ret (); + extern bool_t xdr_remote_list_defined_domains_args (); + extern bool_t xdr_remote_list_defined_domains_ret (); + extern bool_t xdr_remote_num_of_defined_domains_ret (); +Index: libvirt-0.4.6-5ubuntu1/qemud/remote_protocol.x +=================================================================== +--- libvirt-0.4.6-5ubuntu1.orig/qemud/remote_protocol.x 2008-11-18 14:58:19.428585276 +0100 ++++ libvirt-0.4.6-5ubuntu1/qemud/remote_protocol.x 2008-11-18 16:58:42.020582722 +0100 +@@ -519,6 +519,31 @@ + remote_nonnull_domain ddom; + }; + ++struct remote_domain_migrate_prepare2_args { ++ remote_string uri_in; ++ unsigned hyper flags; ++ remote_string dname; ++ unsigned hyper resource; ++ remote_nonnull_string dom_xml; ++}; ++ ++struct remote_domain_migrate_prepare2_ret { ++ opaque cookie; ++ remote_string uri_out; ++}; ++ ++struct remote_domain_migrate_finish2_args { ++ remote_nonnull_string dname; ++ opaque cookie; ++ remote_nonnull_string uri; ++ unsigned hyper flags; ++ int retcode; ++}; ++ ++struct remote_domain_migrate_finish2_ret { ++ remote_nonnull_domain ddom; ++}; ++ + struct remote_list_defined_domains_args { + int maxnames; + }; +@@ -1086,7 +1111,9 @@ + REMOTE_PROC_NODE_GET_FREE_MEMORY = 102, + + REMOTE_PROC_DOMAIN_BLOCK_PEEK = 103, +- REMOTE_PROC_DOMAIN_MEMORY_PEEK = 104 ++ REMOTE_PROC_DOMAIN_MEMORY_PEEK = 104, ++ REMOTE_PROC_DOMAIN_MIGRATE_PREPARE2 = 108, ++ REMOTE_PROC_DOMAIN_MIGRATE_FINISH2 = 109 + }; + + /* Custom RPC structure. */ +Index: libvirt-0.4.6-5ubuntu1/src/driver.h +=================================================================== +--- libvirt-0.4.6-5ubuntu1.orig/src/driver.h 2008-11-18 14:58:19.444584167 +0100 ++++ libvirt-0.4.6-5ubuntu1/src/driver.h 2008-11-18 16:58:42.052582040 +0100 +@@ -55,6 +55,11 @@ + /* Driver is not local. */ + #define VIR_DRV_FEATURE_REMOTE 2 + ++ /* Driver supports V2-style virDomainMigrate, ie. domainMigratePrepare2/ ++ * domainMigratePerform/domainMigrateFinish2. ++ */ ++#define VIR_DRV_FEATURE_MIGRATION_V2 3 ++ + /* Internal feature-detection macro. Don't call drv->supports_feature + * directly, because it may be NULL, use this macro instead. + * +@@ -280,6 +285,28 @@ + (*virDrvNodeGetFreeMemory) + (virConnectPtr conn); + ++typedef int ++ (*virDrvDomainMigratePrepare2) ++ (virConnectPtr dconn, ++ char **cookie, ++ int *cookielen, ++ const char *uri_in, ++ char **uri_out, ++ unsigned long flags, ++ const char *dname, ++ unsigned long resource, ++ const char *dom_xml); ++ ++typedef virDomainPtr ++ (*virDrvDomainMigrateFinish2) ++ (virConnectPtr dconn, ++ const char *dname, ++ const char *cookie, ++ int cookielen, ++ const char *uri, ++ unsigned long flags, ++ int retcode); ++ + /** + * _virDriver: + * +@@ -352,6 +379,8 @@ + virDrvDomainMemoryPeek domainMemoryPeek; + virDrvNodeGetCellsFreeMemory nodeGetCellsFreeMemory; + virDrvNodeGetFreeMemory getFreeMemory; ++ virDrvDomainMigratePrepare2 domainMigratePrepare2; ++ virDrvDomainMigrateFinish2 domainMigrateFinish2; + }; + + typedef int +Index: libvirt-0.4.6-5ubuntu1/src/libvirt.c +=================================================================== +--- libvirt-0.4.6-5ubuntu1.orig/src/libvirt.c 2008-11-18 14:58:19.456583736 +0100 ++++ libvirt-0.4.6-5ubuntu1/src/libvirt.c 2008-11-18 16:58:42.108583012 +0100 +@@ -2166,7 +2166,8 @@ + virDomainPtr ddomain = NULL; + char *uri_out = NULL; + char *cookie = NULL; +- int cookielen = 0, ret; ++ char *dom_xml = NULL; ++ int cookielen = 0, ret, version = 0; + DEBUG("domain=%p, dconn=%p, flags=%lu, dname=%s, uri=%s, bandwidth=%lu", + domain, dconn, flags, dname, uri, bandwidth); + +@@ -2181,10 +2182,17 @@ + } + + /* Check that migration is supported by both drivers. */ +- if (!VIR_DRV_SUPPORTS_FEATURE (conn->driver, conn, +- VIR_DRV_FEATURE_MIGRATION_V1) || +- !VIR_DRV_SUPPORTS_FEATURE (dconn->driver, dconn, +- VIR_DRV_FEATURE_MIGRATION_V1)) { ++ if (VIR_DRV_SUPPORTS_FEATURE (conn->driver, conn, ++ VIR_DRV_FEATURE_MIGRATION_V1) && ++ VIR_DRV_SUPPORTS_FEATURE (dconn->driver, dconn, ++ VIR_DRV_FEATURE_MIGRATION_V1)) ++ version = 1; ++ else if (VIR_DRV_SUPPORTS_FEATURE (conn->driver, conn, ++ VIR_DRV_FEATURE_MIGRATION_V2) && ++ VIR_DRV_SUPPORTS_FEATURE (dconn->driver, dconn, ++ VIR_DRV_FEATURE_MIGRATION_V2)) ++ version = 2; ++ else { + virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__); + return NULL; + } +@@ -2200,17 +2208,49 @@ + * the URI by setting uri_out. If it does not wish to modify + * the URI, it should leave uri_out as NULL. + */ +- ret = dconn->driver->domainMigratePrepare +- (dconn, &cookie, &cookielen, uri, &uri_out, flags, dname, bandwidth); +- if (ret == -1) goto done; +- if (uri == NULL && uri_out == NULL) { +- virLibConnError (conn, VIR_ERR_INTERNAL_ERROR, +- _("domainMigratePrepare did not set uri")); +- goto done; +- } +- if (uri_out) uri = uri_out; /* Did domainMigratePrepare change URI? */ ++ if (version == 1) { ++ ret = dconn->driver->domainMigratePrepare ++ (dconn, &cookie, &cookielen, uri, &uri_out, flags, dname, ++ bandwidth); ++ if (ret == -1) goto done; ++ if (uri == NULL && uri_out == NULL) { ++ virLibConnError (conn, VIR_ERR_INTERNAL_ERROR, ++ _("domainMigratePrepare did not set uri")); ++ goto done; ++ } ++ if (uri_out) uri = uri_out; /* Did domainMigratePrepare change URI? */ ++ ++ assert (uri != NULL); ++ } ++ else /* if (version == 2) */ { ++ /* In version 2 of the protocol, the prepare step is slightly ++ * different. We fetch the domain XML of the source domain ++ * and pass it to Prepare2. ++ */ ++ if (!conn->driver->domainDumpXML) { ++ virLibConnError (conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__); ++ return NULL; ++ } ++ dom_xml = conn->driver->domainDumpXML (domain, ++ VIR_DOMAIN_XML_SECURE); ++ ++ if (!dom_xml) ++ return NULL; ++ ++ ret = dconn->driver->domainMigratePrepare2 ++ (dconn, &cookie, &cookielen, uri, &uri_out, flags, dname, ++ bandwidth, dom_xml); ++ free (dom_xml); ++ if (ret == -1) goto done; ++ if (uri == NULL && uri_out == NULL) { ++ virLibConnError (conn, VIR_ERR_INTERNAL_ERROR, ++ _("domainMigratePrepare2 did not set uri")); ++ goto done; ++ } ++ if (uri_out) uri = uri_out; /* Did domainMigratePrepare2 change URI? */ + +- assert (uri != NULL); ++ assert (uri != NULL); ++ } + + /* Perform the migration. The driver isn't supposed to return + * until the migration is complete. +@@ -2218,18 +2258,28 @@ + ret = conn->driver->domainMigratePerform + (domain, cookie, cookielen, uri, flags, dname, bandwidth); + +- if (ret == -1) goto done; +- +- /* Get the destination domain and return it or error. +- * 'domain' no longer actually exists at this point (or so we hope), but +- * we still use the object in memory in order to get the name. +- */ +- dname = dname ? dname : domain->name; +- if (dconn->driver->domainMigrateFinish) +- ddomain = dconn->driver->domainMigrateFinish +- (dconn, dname, cookie, cookielen, uri, flags); +- else +- ddomain = virDomainLookupByName (dconn, dname); ++ if (version == 1) { ++ if (ret == -1) goto done; ++ /* Get the destination domain and return it or error. ++ * 'domain' no longer actually exists at this point ++ * (or so we hope), but we still use the object in memory ++ * in order to get the name. ++ */ ++ dname = dname ? dname : domain->name; ++ if (dconn->driver->domainMigrateFinish) ++ ddomain = dconn->driver->domainMigrateFinish ++ (dconn, dname, cookie, cookielen, uri, flags); ++ else ++ ddomain = virDomainLookupByName (dconn, dname); ++ } else /* if (version == 2) */ { ++ /* In version 2 of the migration protocol, we pass the ++ * status code from the sender to the destination host, ++ * so it can do any cleanup if the migration failed. ++ */ ++ dname = dname ? dname : domain->name; ++ ddomain = dconn->driver->domainMigrateFinish2 ++ (dconn, dname, cookie, cookielen, uri, flags, ret); ++ } + + done: + free (uri_out); +@@ -2324,6 +2374,67 @@ + } + + ++/* Not for public use. This function is part of the internal ++ * implementation of migration in the remote case. ++ */ ++int ++__virDomainMigratePrepare2 (virConnectPtr dconn, ++ char **cookie, ++ int *cookielen, ++ const char *uri_in, ++ char **uri_out, ++ unsigned long flags, ++ const char *dname, ++ unsigned long bandwidth, ++ const char *dom_xml) ++{ ++ DEBUG("dconn=%p, cookie=%p, cookielen=%p, uri_in=%s, uri_out=%p, flags=%lu, dname=%s, bandwidth=%lu, dom_xml=%s", dconn, cookie, cookielen, uri_in, uri_out, flags, dname, bandwidth, dom_xml); ++ ++ if (!VIR_IS_CONNECT (dconn)) { ++ virLibConnError (NULL, VIR_ERR_INVALID_CONN, __FUNCTION__); ++ return -1; ++ } ++ ++ if (dconn->driver->domainMigratePrepare2) ++ return dconn->driver->domainMigratePrepare2 (dconn, cookie, cookielen, ++ uri_in, uri_out, ++ flags, dname, bandwidth, ++ dom_xml); ++ ++ virLibConnError (dconn, VIR_ERR_NO_SUPPORT, __FUNCTION__); ++ return -1; ++} ++ ++/* Not for public use. This function is part of the internal ++ * implementation of migration in the remote case. ++ */ ++virDomainPtr ++__virDomainMigrateFinish2 (virConnectPtr dconn, ++ const char *dname, ++ const char *cookie, ++ int cookielen, ++ const char *uri, ++ unsigned long flags, ++ int retcode) ++{ ++ DEBUG("dconn=%p, dname=%s, cookie=%p, cookielen=%d, uri=%s, flags=%lu, retcode=%d", dconn, dname, cookie, cookielen, uri, flags, retcode); ++ ++ if (!VIR_IS_CONNECT (dconn)) { ++ virLibConnError (NULL, VIR_ERR_INVALID_CONN, __FUNCTION__); ++ return NULL; ++ } ++ ++ if (dconn->driver->domainMigrateFinish2) ++ return dconn->driver->domainMigrateFinish2 (dconn, dname, ++ cookie, cookielen, ++ uri, flags, ++ retcode); ++ ++ virLibConnError (dconn, VIR_ERR_NO_SUPPORT, __FUNCTION__); ++ return NULL; ++} ++ ++ + /** + * virNodeGetInfo: + * @conn: pointer to the hypervisor connection +Index: libvirt-0.4.6-5ubuntu1/src/libvirt_sym.version +=================================================================== +--- libvirt-0.4.6-5ubuntu1.orig/src/libvirt_sym.version 2008-11-18 14:58:19.472585351 +0100 ++++ libvirt-0.4.6-5ubuntu1/src/libvirt_sym.version 2008-11-18 16:58:42.124583649 +0100 +@@ -179,6 +179,8 @@ + __virDomainMigratePrepare; + __virDomainMigratePerform; + __virDomainMigrateFinish; ++ __virDomainMigratePrepare2; ++ __virDomainMigrateFinish2; + + __virFileReadAll; + __virStrToLong_i; +Index: libvirt-0.4.6-5ubuntu1/src/lxc_driver.c +=================================================================== +--- libvirt-0.4.6-5ubuntu1.orig/src/lxc_driver.c 2008-11-18 14:58:19.484585410 +0100 ++++ libvirt-0.4.6-5ubuntu1/src/lxc_driver.c 2008-11-18 16:58:42.136583289 +0100 +@@ -1203,6 +1203,8 @@ + NULL, /* domainMemoryPeek */ + NULL, /* nodeGetCellsFreeMemory */ + NULL, /* getFreeMemory */ ++ NULL, /* domainMigratePrepare2 */ ++ NULL, /* domainMigrateFinish2 */ + }; + + +Index: libvirt-0.4.6-5ubuntu1/src/openvz_driver.c +=================================================================== +--- libvirt-0.4.6-5ubuntu1.orig/src/openvz_driver.c 2008-11-18 14:58:19.500586675 +0100 ++++ libvirt-0.4.6-5ubuntu1/src/openvz_driver.c 2008-11-18 16:58:42.160583336 +0100 +@@ -1014,6 +1014,8 @@ + NULL, /* domainMemoryPeek */ + NULL, /* nodeGetCellsFreeMemory */ + NULL, /* nodeGetFreeMemory */ ++ NULL, /* domainMigratePrepare2 */ ++ NULL, /* domainMigrateFinish2 */ + }; + + int openvzRegister(void) { +Index: libvirt-0.4.6-5ubuntu1/src/qemu_conf.h +=================================================================== +--- libvirt-0.4.6-5ubuntu1.orig/src/qemu_conf.h 2008-11-18 14:58:19.516584798 +0100 ++++ libvirt-0.4.6-5ubuntu1/src/qemu_conf.h 2008-11-18 16:58:42.160583336 +0100 +@@ -70,6 +70,9 @@ + virCapsPtr caps; + }; + ++/* Port numbers used for KVM migration. */ ++#define QEMUD_MIGRATION_FIRST_PORT 49152 ++#define QEMUD_MIGRATION_NUM_PORTS 64 + + void qemudReportError(virConnectPtr conn, + virDomainPtr dom, +Index: libvirt-0.4.6-5ubuntu1/src/qemu_driver.c +=================================================================== +--- libvirt-0.4.6-5ubuntu1.orig/src/qemu_driver.c 2008-11-18 16:58:41.424587981 +0100 ++++ libvirt-0.4.6-5ubuntu1/src/qemu_driver.c 2008-11-18 18:02:45.805585216 +0100 +@@ -755,7 +755,8 @@ + static int + qemudInitCpus(virConnectPtr conn, + struct qemud_driver *driver, +- virDomainObjPtr vm) { ++ virDomainObjPtr vm, ++ const char *migrateFrom) { + char *info = NULL; + #if HAVE_SCHED_GETAFFINITY + cpu_set_t mask; +@@ -791,13 +792,15 @@ + } + #endif /* HAVE_SCHED_GETAFFINITY */ + +- /* Allow the CPUS to start executing */ +- if (qemudMonitorCommand(driver, vm, "cont", &info) < 0) { +- qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, +- "%s", _("resume operation failed")); +- return -1; ++ if (migrateFrom == NULL) { ++ /* Allow the CPUS to start executing */ ++ if (qemudMonitorCommand(driver, vm, "cont", &info) < 0) { ++ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, ++ "%s", _("resume operation failed")); ++ return -1; ++ } ++ VIR_FREE(info); + } +- VIR_FREE(info); + + return 0; + } +@@ -996,7 +999,7 @@ + driver) < 0) || + (qemudWaitForMonitor(conn, driver, vm) < 0) || + (qemudDetectVcpuPIDs(conn, driver, vm) < 0) || +- (qemudInitCpus(conn, driver, vm) < 0)) { ++ (qemudInitCpus(conn, driver, vm, migrateFrom) < 0)) { + qemudShutdownVMDaemon(conn, driver, vm); + return -1; + } +@@ -1799,6 +1802,16 @@ + return 0; + } + ++/* Which features are supported by this driver? */ ++static int ++qemudSupportsFeature (virConnectPtr conn ATTRIBUTE_UNUSED, int feature) ++{ ++ switch (feature) { ++ case VIR_DRV_FEATURE_MIGRATION_V2: return 1; ++ default: return 0; ++ } ++} ++ + static const char *qemudGetType(virConnectPtr conn ATTRIBUTE_UNUSED) { + return "QEMU"; + } +@@ -4017,6 +4030,260 @@ + return 0; + } + ++/* Migration support. */ ++ ++/* Prepare is the first step, and it runs on the destination host. ++ * ++ * This starts an empty VM listening on a TCP port. ++ */ ++static int ++qemudDomainMigratePrepare2 (virConnectPtr dconn, ++ char **cookie ATTRIBUTE_UNUSED, ++ int *cookielen ATTRIBUTE_UNUSED, ++ const char *uri_in, ++ char **uri_out, ++ unsigned long flags ATTRIBUTE_UNUSED, ++ const char *dname, ++ unsigned long resource ATTRIBUTE_UNUSED, ++ const char *dom_xml) ++{ ++ static int port = 0; ++ struct qemud_driver *driver = (struct qemud_driver *)dconn->privateData; ++ virDomainDefPtr def; ++ virDomainObjPtr vm = NULL; ++ int this_port; ++ char hostname [HOST_NAME_MAX+1]; ++ char migrateFrom [64]; ++ const char *p; ++ ++ if (!dom_xml) { ++ qemudReportError (dconn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, ++ "%s", _("no domain XML passed")); ++ return -1; ++ } ++ ++ /* The URI passed in may be NULL or a string "tcp://somehostname:port". ++ * ++ * If the URI passed in is NULL then we allocate a port number ++ * from our pool of port numbers and return a URI of ++ * "tcp://ourhostname:port". ++ * ++ * If the URI passed in is not NULL then we try to parse out the ++ * port number and use that (note that the hostname is assumed ++ * to be a correct hostname which refers to the target machine). ++ */ ++ if (uri_in == NULL) { ++ this_port = QEMUD_MIGRATION_FIRST_PORT + port++; ++ if (port == QEMUD_MIGRATION_NUM_PORTS) port = 0; ++ ++ /* Get hostname */ ++ if (gethostname (hostname, HOST_NAME_MAX+1) == -1) { ++ qemudReportError (dconn, NULL, NULL, VIR_ERR_SYSTEM_ERROR, ++ "%s", strerror (errno)); ++ return -1; ++ } ++ ++ /* Caller frees */ ++ if (asprintf(uri_out, "tcp:%s:%d", hostname, this_port) < 0) { ++ qemudReportError (dconn, NULL, NULL, VIR_ERR_NO_MEMORY, ++ "%s", strerror (errno)); ++ return -1; ++ } ++ } else { ++ /* Check the URI starts with "tcp:". We will escape the ++ * URI when passing it to the qemu monitor, so bad ++ * characters in hostname part don't matter. ++ */ ++ if (!STREQLEN (uri_in, "tcp:", 6)) { ++ qemudReportError (dconn, NULL, NULL, VIR_ERR_INVALID_ARG, ++ "%s", _("only tcp URIs are supported for KVM migrations")); ++ return -1; ++ } ++ ++ /* Get the port number. */ ++ p = strrchr (uri_in, ':'); ++ p++; /* definitely has a ':' in it, see above */ ++ this_port = virParseNumber (&p); ++ if (this_port == -1 || p-uri_in != strlen (uri_in)) { ++ qemudReportError (dconn, NULL, NULL, VIR_ERR_INVALID_ARG, ++ "%s", _("URI did not have ':port' at the end")); ++ return -1; ++ } ++ } ++ ++ /* Parse the domain XML. */ ++ if (!(def = virDomainDefParseString(dconn, driver->caps, dom_xml))) { ++ qemudReportError (dconn, NULL, NULL, VIR_ERR_OPERATION_FAILED, ++ "%s", _("failed to parse XML")); ++ return -1; ++ } ++ ++ /* Target domain name, maybe renamed. */ ++ dname = dname ? dname : def->name; ++ ++#if 1 ++ /* Ensure the name and UUID don't already exist in an active VM */ ++ vm = virDomainFindByUUID(driver->domains, def->uuid); ++#else ++ /* For TESTING ONLY you can change #if 1 -> #if 0 above and use ++ * this code which lets you do localhost migrations. You must still ++ * supply a fresh 'dname' but this code assigns a random UUID. ++ */ ++ if (virUUIDGenerate (def->uuid) == -1) { ++ qemudReportError (dconn, NULL, NULL, VIR_ERR_OPERATION_FAILED, ++ _("could not generate random UUID")); ++ } ++#endif ++ ++ if (!vm) vm = virDomainFindByName(driver->domains, dname); ++ if (vm) { ++ if (virDomainIsActive(vm)) { ++ qemudReportError (dconn, NULL, NULL, VIR_ERR_OPERATION_FAILED, ++ _("domain with the same name or UUID already exists as '%s'"), ++ vm->def->name); ++ virDomainDefFree(def); ++ return -1; ++ } ++ } ++ ++ if (!(vm = virDomainAssignDef(dconn, ++ &driver->domains, ++ def))) { ++ qemudReportError (dconn, NULL, NULL, VIR_ERR_OPERATION_FAILED, ++ "%s", _("failed to assign new VM")); ++ virDomainDefFree(def); ++ return -1; ++ } ++ ++ /* Domain starts inactive, even if the domain XML had an id field. */ ++ vm->def->id = -1; ++ ++ /* Start the QEMU daemon, with the same command-line arguments plus ++ * -incoming tcp:0.0.0.0:port ++ */ ++ snprintf (migrateFrom, sizeof (migrateFrom), "tcp:0.0.0.0:%d", this_port); ++ if (qemudStartVMDaemon (dconn, driver, vm, migrateFrom) < 0) { ++ qemudReportError (dconn, NULL, NULL, VIR_ERR_OPERATION_FAILED, ++ "%s", _("failed to start listening VM")); ++ if (!vm->persistent) ++ virDomainRemoveInactive(&driver->domains, vm); ++ ++ return -1; ++ } ++ ++ return 0; ++} ++ ++/* Perform is the second step, and it runs on the source host. */ ++static int ++qemudDomainMigratePerform (virDomainPtr dom, ++ const char *cookie ATTRIBUTE_UNUSED, ++ int cookielen ATTRIBUTE_UNUSED, ++ const char *uri, ++ unsigned long flags ATTRIBUTE_UNUSED, ++ const char *dname ATTRIBUTE_UNUSED, ++ unsigned long resource) ++{ ++ struct qemud_driver *driver = (struct qemud_driver *)dom->conn->privateData; ++ virDomainObjPtr vm = virDomainFindByID(driver->domains, dom->id); ++ char *safe_uri; ++ char cmd[HOST_NAME_MAX+50]; ++ char *info; ++ ++ if (!vm) { ++ qemudReportError (dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN, ++ _("no domain with matching id %d"), dom->id); ++ return -1; ++ } ++ ++ if (!virDomainIsActive(vm)) { ++ qemudReportError (dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, ++ "%s", _("domain is not running")); ++ return -1; ++ } ++ ++ if (resource > 0) { ++ /* Issue migrate_set_speed command. Don't worry if it fails. */ ++ snprintf (cmd, sizeof cmd, "migrate_set_speed %lum", resource); ++ qemudMonitorCommand (driver, vm, cmd, &info); ++ ++ DEBUG ("migrate_set_speed reply: %s", info); ++ VIR_FREE (info); ++ } ++ ++ /* Issue the migrate command. */ ++ safe_uri = qemudEscapeMonitorArg (uri); ++ if (!safe_uri) { ++ qemudReportError (dom->conn, dom, NULL, VIR_ERR_SYSTEM_ERROR, ++ "%s", strerror (errno)); ++ return -1; ++ } ++ snprintf (cmd, sizeof cmd, "migrate \"%s\"", safe_uri); ++ VIR_FREE (safe_uri); ++ ++ if (qemudMonitorCommand (driver, vm, cmd, &info) < 0) { ++ qemudReportError (dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, ++ "%s", _("migrate operation failed")); ++ return -1; ++ } ++ ++ DEBUG ("migrate reply: %s", info); ++ ++ /* Now check for "fail" in the output string */ ++ if (strstr(info, "fail") != NULL) { ++ qemudReportError (dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, ++ _("migrate failed: %s"), info); ++ VIR_FREE(info); ++ return -1; ++ } ++ ++ VIR_FREE (info); ++ ++ /* Clean up the source domain. */ ++ qemudShutdownVMDaemon (dom->conn, driver, vm); ++ if (!vm->persistent) ++ virDomainRemoveInactive(&driver->domains, vm); ++ ++ return 0; ++} ++ ++/* Finish is the third and final step, and it runs on the destination host. */ ++static virDomainPtr ++qemudDomainMigrateFinish2 (virConnectPtr dconn, ++ const char *dname, ++ const char *cookie ATTRIBUTE_UNUSED, ++ int cookielen ATTRIBUTE_UNUSED, ++ const char *uri ATTRIBUTE_UNUSED, ++ unsigned long flags ATTRIBUTE_UNUSED, ++ int retcode) ++{ ++ struct qemud_driver *driver = (struct qemud_driver *)dconn->privateData; ++ virDomainObjPtr vm = virDomainFindByName(driver->domains, dname); ++ virDomainPtr dom; ++ char *info = NULL; ++ ++ if (!vm) { ++ qemudReportError (dconn, NULL, NULL, VIR_ERR_INVALID_DOMAIN, ++ _("no domain with matching name %s"), dname); ++ return NULL; ++ } ++ ++ /* Did the migration go as planned? If yes, return the domain ++ * object, but if no, clean up the empty qemu process. ++ */ ++ if (retcode == 0) { ++ dom = virGetDomain (dconn, vm->def->name, vm->def->uuid); ++ VIR_FREE(info); ++ vm->state = VIR_DOMAIN_RUNNING; ++ return dom; ++ } else { ++ qemudShutdownVMDaemon (dconn, driver, vm); ++ if (!vm->persistent) ++ virDomainRemoveInactive(&driver->domains, vm); ++ return NULL; ++ } ++} ++ + static virDriver qemuDriver = { + VIR_DRV_QEMU, + "QEMU", +@@ -4024,7 +4291,7 @@ + qemudProbe, /* probe */ + qemudOpen, /* open */ + qemudClose, /* close */ +- NULL, /* supports_feature */ ++ qemudSupportsFeature, /* supports_feature */ + qemudGetType, /* type */ + qemudGetVersion, /* version */ + qemudGetHostname, /* hostname */ +@@ -4073,8 +4340,8 @@ + NULL, /* domainGetSchedulerType */ + NULL, /* domainGetSchedulerParameters */ + NULL, /* domainSetSchedulerParameters */ +- NULL, /* domainMigratePrepare */ +- NULL, /* domainMigratePerform */ ++ NULL, /* domainMigratePrepare (v1) */ ++ qemudDomainMigratePerform, /* domainMigratePerform */ + NULL, /* domainMigrateFinish */ + qemudDomainBlockStats, /* domainBlockStats */ + qemudDomainInterfaceStats, /* domainInterfaceStats */ +@@ -4087,6 +4354,8 @@ + NULL, /* nodeGetCellsFreeMemory */ + NULL, /* getFreeMemory */ + #endif ++ qemudDomainMigratePrepare2, /* domainMigratePrepare2 */ ++ qemudDomainMigrateFinish2, /* domainMigrateFinish2 */ + }; + + static virNetworkDriver qemuNetworkDriver = { +Index: libvirt-0.4.6-5ubuntu1/src/remote_internal.c +=================================================================== +--- libvirt-0.4.6-5ubuntu1.orig/src/remote_internal.c 2008-11-18 14:58:19.544583957 +0100 ++++ libvirt-0.4.6-5ubuntu1/src/remote_internal.c 2008-11-18 16:58:42.188583334 +0100 +@@ -1953,6 +1953,73 @@ + } + + static int ++remoteDomainMigratePrepare2 (virConnectPtr dconn, ++ char **cookie, int *cookielen, ++ const char *uri_in, char **uri_out, ++ unsigned long flags, const char *dname, ++ unsigned long resource, ++ const char *dom_xml) ++{ ++ remote_domain_migrate_prepare2_args args; ++ remote_domain_migrate_prepare2_ret ret; ++ GET_PRIVATE (dconn, -1); ++ ++ args.uri_in = uri_in == NULL ? NULL : (char **) &uri_in; ++ args.flags = flags; ++ args.dname = dname == NULL ? NULL : (char **) &dname; ++ args.resource = resource; ++ args.dom_xml = (char *) dom_xml; ++ ++ memset (&ret, 0, sizeof ret); ++ if (call (dconn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_PREPARE2, ++ (xdrproc_t) xdr_remote_domain_migrate_prepare2_args, (char *) &args, ++ (xdrproc_t) xdr_remote_domain_migrate_prepare2_ret, (char *) &ret) == -1) ++ return -1; ++ ++ if (ret.cookie.cookie_len > 0) { ++ *cookie = ret.cookie.cookie_val; /* Caller frees. */ ++ *cookielen = ret.cookie.cookie_len; ++ } ++ if (ret.uri_out) ++ *uri_out = *ret.uri_out; /* Caller frees. */ ++ ++ return 0; ++} ++ ++static virDomainPtr ++remoteDomainMigrateFinish2 (virConnectPtr dconn, ++ const char *dname, ++ const char *cookie, ++ int cookielen, ++ const char *uri, ++ unsigned long flags, ++ int retcode) ++{ ++ virDomainPtr ddom; ++ remote_domain_migrate_finish2_args args; ++ remote_domain_migrate_finish2_ret ret; ++ GET_PRIVATE (dconn, NULL); ++ ++ args.dname = (char *) dname; ++ args.cookie.cookie_len = cookielen; ++ args.cookie.cookie_val = (char *) cookie; ++ args.uri = (char *) uri; ++ args.flags = flags; ++ args.retcode = retcode; ++ ++ memset (&ret, 0, sizeof ret); ++ if (call (dconn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_FINISH2, ++ (xdrproc_t) xdr_remote_domain_migrate_finish2_args, (char *) &args, ++ (xdrproc_t) xdr_remote_domain_migrate_finish2_ret, (char *) &ret) == -1) ++ return NULL; ++ ++ ddom = get_nonnull_domain (dconn, ret.ddom); ++ xdr_free ((xdrproc_t) &xdr_remote_domain_migrate_finish2_ret, (char *) &ret); ++ ++ return ddom; ++} ++ ++static int + remoteListDefinedDomains (virConnectPtr conn, char **const names, int maxnames) + { + int i; +@@ -4875,6 +4942,8 @@ + .domainMemoryPeek = remoteDomainMemoryPeek, + .nodeGetCellsFreeMemory = remoteNodeGetCellsFreeMemory, + .getFreeMemory = remoteNodeGetFreeMemory, ++ .domainMigratePrepare2 = remoteDomainMigratePrepare2, ++ .domainMigrateFinish2 = remoteDomainMigrateFinish2, + }; + + static virNetworkDriver network_driver = { +Index: libvirt-0.4.6-5ubuntu1/src/test.c +=================================================================== +--- libvirt-0.4.6-5ubuntu1.orig/src/test.c 2008-11-18 14:58:19.556585622 +0100 ++++ libvirt-0.4.6-5ubuntu1/src/test.c 2008-11-18 16:58:42.220582652 +0100 +@@ -1595,6 +1595,8 @@ + NULL, /* domainMemoryPeek */ + testNodeGetCellsFreeMemory, /* nodeGetCellsFreeMemory */ + NULL, /* getFreeMemory */ ++ NULL, /* domainMigratePrepare2 */ ++ NULL, /* domainMigrateFinish2 */ + }; + + static virNetworkDriver testNetworkDriver = { +Index: libvirt-0.4.6-5ubuntu1/src/virsh.c +=================================================================== +--- libvirt-0.4.6-5ubuntu1.orig/src/virsh.c 2008-11-18 16:58:41.700584860 +0100 ++++ libvirt-0.4.6-5ubuntu1/src/virsh.c 2008-11-18 16:58:42.224583161 +0100 +@@ -2228,6 +2228,7 @@ + {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("domain name, id or uuid")}, + {"desturi", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("connection URI of the destination host")}, + {"migrateuri", VSH_OT_DATA, 0, gettext_noop("migration URI, usually can be omitted")}, ++ {"dname", VSH_OT_DATA, 0, gettext_noop("rename to new name during migration (if supported)")}, + {NULL, 0, 0, NULL} + }; + +@@ -2237,6 +2238,7 @@ + virDomainPtr dom = NULL; + const char *desturi; + const char *migrateuri; ++ const char *dname; + int flags = 0, found, ret = FALSE; + virConnectPtr dconn = NULL; + virDomainPtr ddom = NULL; +@@ -2256,6 +2258,9 @@ + migrateuri = vshCommandOptString (cmd, "migrateuri", &found); + if (!found) migrateuri = NULL; + ++ dname = vshCommandOptString (cmd, "dname", &found); ++ if (!found) migrateuri = dname; ++ + if (vshCommandOptBool (cmd, "live")) + flags |= VIR_MIGRATE_LIVE; + +@@ -2264,7 +2269,7 @@ + if (!dconn) goto done; + + /* Migrate. */ +- ddom = virDomainMigrate (dom, dconn, flags, NULL, migrateuri, 0); ++ ddom = virDomainMigrate (dom, dconn, flags, dname, migrateuri, 0); + if (!ddom) goto done; + + ret = TRUE; +Index: libvirt-0.4.6-5ubuntu1/src/internal.h +=================================================================== +--- libvirt-0.4.6-5ubuntu1.orig/src/internal.h 2008-11-18 14:58:19.588587664 +0100 ++++ libvirt-0.4.6-5ubuntu1/src/internal.h 2008-11-18 16:58:42.252581970 +0100 +@@ -361,6 +361,8 @@ + int __virDomainMigratePrepare (virConnectPtr dconn, char **cookie, int *cookielen, const char *uri_in, char **uri_out, unsigned long flags, const char *dname, unsigned long bandwidth); + int __virDomainMigratePerform (virDomainPtr domain, const char *cookie, int cookielen, const char *uri, unsigned long flags, const char *dname, unsigned long bandwidth); + virDomainPtr __virDomainMigrateFinish (virConnectPtr dconn, const char *dname, const char *cookie, int cookielen, const char *uri, unsigned long flags); ++int __virDomainMigratePrepare2 (virConnectPtr dconn, char **cookie, int *cookielen, const char *uri_in, char **uri_out, unsigned long flags, const char *dname, unsigned long bandwidth, const char *dom_xml); ++virDomainPtr __virDomainMigrateFinish2 (virConnectPtr dconn, const char *dname, const char *cookie, int cookielen, const char *uri, unsigned long flags, int retcode); + + typedef struct _virStringList virStringList; +