diff --git a/0001-qemu-Fix-checking-of-ABI-stability-when-restoring-ex.patch b/0001-qemu-Fix-checking-of-ABI-stability-when-restoring-ex.patch new file mode 100644 index 0000000..c32c397 --- /dev/null +++ b/0001-qemu-Fix-checking-of-ABI-stability-when-restoring-ex.patch @@ -0,0 +1,62 @@ +From 973fda18d4f5be790b912dde5c8f13a5812388c3 Mon Sep 17 00:00:00 2001 +From: Peter Krempa +Date: Mon, 16 Sep 2013 13:37:34 +0200 +Subject: [PATCH] qemu: Fix checking of ABI stability when restoring external + checkpoints + +External checkpoints have a bug in the implementation where they use the +normal definition instead of the "migratable" one. This causes errors +when the snapshot is being reverted using the workaround method via +qemuDomainRestoreFlags() with a custom XML. This issue was introduced +when commit 07966f6a8b5ccb5bb4c716b25deb8ba2e572cc67 changed the code to +compare "migratable" XMLs from the user as we should have used +migratable in the image too. + +This patch adds a compatibility layer, so that fixing the snapshot code +won't make existing snapshots fail to load. + +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1008340 +(cherry picked from commit 59898a88ce8431bd3ea249b8789edc2ef9985827) +--- + src/qemu/qemu_driver.c | 23 ++++++++++++++++++++--- + 1 file changed, 20 insertions(+), 3 deletions(-) + +diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c +index 3db3447..3ab7280 100644 +--- a/src/qemu/qemu_driver.c ++++ b/src/qemu/qemu_driver.c +@@ -4696,14 +4696,31 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver, + goto error; + + newdef = qemuDomainDefCopy(driver, def2, VIR_DOMAIN_XML_MIGRATABLE); +- virDomainDefFree(def2); +- if (!newdef) ++ if (!newdef) { ++ virDomainDefFree(def2); + goto error; ++ } + + if (!virDomainDefCheckABIStability(def, newdef)) { + virDomainDefFree(newdef); +- goto error; ++ virResetLastError(); ++ ++ /* Due to a bug in older version of external snapshot creation ++ * code, the XML saved in the save image was not a migratable ++ * XML. To ensure backwards compatibility with the change of the ++ * saved XML type, we need to check the ABI compatibility against ++ * the user provided XML if the check against the migratable XML ++ * fails. Snapshots created prior to v1.1.3 have this issue. */ ++ if (!virDomainDefCheckABIStability(def, def2)) { ++ virDomainDefFree(def2); ++ goto error; ++ } ++ ++ /* use the user provided XML */ ++ newdef = def2; ++ def2 = NULL; + } ++ + virDomainDefFree(def); + def = newdef; + } diff --git a/0002-qemu-Use-migratable-XML-definition-when-doing-extern.patch b/0002-qemu-Use-migratable-XML-definition-when-doing-extern.patch new file mode 100644 index 0000000..e1ecb58 --- /dev/null +++ b/0002-qemu-Use-migratable-XML-definition-when-doing-extern.patch @@ -0,0 +1,35 @@ +From e3905e84a3bcd66841f3a40d63a5a98d563424ac Mon Sep 17 00:00:00 2001 +From: Peter Krempa +Date: Mon, 16 Sep 2013 13:40:42 +0200 +Subject: [PATCH] qemu: Use "migratable" XML definition when doing external + checkpoints + +In the original implementation of external checkpoints I've mistakenly +used the live definition to be stored in the save image. The normal +approach is to use the "migratable" definition. This was discovered when +commit 07966f6a8b5ccb5bb4c716b25deb8ba2e572cc67 changed the behavior to +use a converted XML from the user to do the compatibility check to fix +problem when using the regular machine saving. + +As the previous patch added a compatibility layer, we can now change the +type of the XML in the image. + +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1008340 +(cherry picked from commit 1b7bfa65e36996fc3a204452d2a844ab9f4b52b3) +--- + src/qemu/qemu_driver.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c +index 3ab7280..bdb7adb 100644 +--- a/src/qemu/qemu_driver.c ++++ b/src/qemu/qemu_driver.c +@@ -11211,7 +11211,7 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn, + JOB_MASK(QEMU_JOB_SUSPEND) | + JOB_MASK(QEMU_JOB_MIGRATION_OP)); + +- if (!(xml = qemuDomainDefFormatLive(driver, vm->def, true, false))) ++ if (!(xml = qemuDomainDefFormatLive(driver, vm->def, true, true))) + goto endjob; + + if ((ret = qemuDomainSaveMemory(driver, vm, snap->def->file, diff --git a/libvirt.spec b/libvirt.spec index 83a7231..9d8fded 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -341,7 +341,7 @@ Summary: Library providing a simple virtualization API Name: libvirt Version: 1.0.5.6 -Release: 1%{?dist}%{?extra_release} +Release: 2%{?dist}%{?extra_release} License: LGPLv2+ Group: Development/Libraries BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root @@ -352,6 +352,10 @@ URL: http://libvirt.org/ %endif Source: http://libvirt.org/sources/%{?mainturl}libvirt-%{version}.tar.gz +# Fix snapshot restore when VM has disabled usb support (bz #1011520) +Patch0001: 0001-qemu-Fix-checking-of-ABI-stability-when-restoring-ex.patch +Patch0002: 0002-qemu-Use-migratable-XML-definition-when-doing-extern.patch + %if %{with_libvirtd} Requires: libvirt-daemon = %{version}-%{release} %if %{with_network} @@ -1084,6 +1088,10 @@ of recent versions of Linux (and other OSes). %prep %setup -q +# Fix snapshot restore when VM has disabled usb support (bz #1011520) +%patch0001 -p1 +%patch0002 -p1 + %build %if ! %{with_xen} %define _without_xen --without-xen @@ -2005,6 +2013,9 @@ fi %endif %changelog +* Tue Sep 24 2013 Cole Robinson - 1.0.5.6-2 +- Fix snapshot restore when VM has disabled usb support (bz #1011520) + * Fri Sep 20 2013 Cole Robinson - 1.0.5.6-1 - Rebased to version 1.0.5.6 - Fix blockjobinfo python API (bz #999077)