[libvirt] Fix snapshot restore when VM has disabled usb support (bz #1011520)
Cole Robinson
crobinso at fedoraproject.org
Tue Sep 24 14:27:49 UTC 2013
commit b884323c030f49a463d5a46d2f5ec73571e80a00
Author: Cole Robinson <crobinso at redhat.com>
Date: Tue Sep 24 10:27:38 2013 -0400
Fix snapshot restore when VM has disabled usb support (bz #1011520)
...ecking-of-ABI-stability-when-restoring-ex.patch | 62 ++++++++++++++++++++
...gratable-XML-definition-when-doing-extern.patch | 35 +++++++++++
libvirt.spec | 13 ++++-
3 files changed, 109 insertions(+), 1 deletions(-)
---
diff --git a/0201-qemu-Fix-checking-of-ABI-stability-when-restoring-ex.patch b/0201-qemu-Fix-checking-of-ABI-stability-when-restoring-ex.patch
new file mode 100644
index 0000000..75e024c
--- /dev/null
+++ b/0201-qemu-Fix-checking-of-ABI-stability-when-restoring-ex.patch
@@ -0,0 +1,62 @@
+From 08a0e5d5ab9a0254045e6b6304bfdb7061f5e249 Mon Sep 17 00:00:00 2001
+From: Peter Krempa <pkrempa at redhat.com>
+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 ed29373..3a7c9d0 100644
+--- a/src/qemu/qemu_driver.c
++++ b/src/qemu/qemu_driver.c
+@@ -5251,14 +5251,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/0202-qemu-Use-migratable-XML-definition-when-doing-extern.patch b/0202-qemu-Use-migratable-XML-definition-when-doing-extern.patch
new file mode 100644
index 0000000..79f69fa
--- /dev/null
+++ b/0202-qemu-Use-migratable-XML-definition-when-doing-extern.patch
@@ -0,0 +1,35 @@
+From 438dc5b4e161f675575c6febb07d75fbf6022d6e Mon Sep 17 00:00:00 2001
+From: Peter Krempa <pkrempa at redhat.com>
+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 3a7c9d0..c500728 100644
+--- a/src/qemu/qemu_driver.c
++++ b/src/qemu/qemu_driver.c
+@@ -12186,7 +12186,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 8087176..c938b52 100644
--- a/libvirt.spec
+++ b/libvirt.spec
@@ -369,7 +369,7 @@
Summary: Library providing a simple virtualization API
Name: libvirt
Version: 1.1.2
-Release: 3%{?dist}%{?extra_release}
+Release: 4%{?dist}%{?extra_release}
License: LGPLv2+
Group: Development/Libraries
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
@@ -404,6 +404,10 @@ Patch0110: 0110-Fix-typo-in-identity-code-which-is-pre-requisite-for.patch
Patch0111: 0111-Add-a-virNetSocketNewConnectSockFD-method.patch
Patch0112: 0112-Add-test-case-for-virNetServerClient-object-identity.patch
+# Fix snapshot restore when VM has disabled usb support (bz #1011520)
+Patch0201: 0201-qemu-Fix-checking-of-ABI-stability-when-restoring-ex.patch
+Patch0202: 0202-qemu-Use-migratable-XML-definition-when-doing-extern.patch
+
%if %{with_libvirtd}
Requires: libvirt-daemon = %{version}-%{release}
%if %{with_network}
@@ -1204,6 +1208,10 @@ of recent versions of Linux (and other OSes).
%patch0111 -p1
%patch0112 -p1
+# Fix snapshot restore when VM has disabled usb support (bz #1011520)
+%patch0201 -p1
+%patch0202 -p1
+
%build
%if ! %{with_xen}
%define _without_xen --without-xen
@@ -2157,6 +2165,9 @@ fi
%endif
%changelog
+* Tue Sep 24 2013 Cole Robinson <crobinso at redhat.com> - 1.1.2-4
+- Fix snapshot restore when VM has disabled usb support (bz #1011520)
+
* Mon Sep 23 2013 Cole Robinson <crobinso at redhat.com> - 1.1.2-3
- Sync with v1.1.2-maint
- Rebuild for libswan soname bump (bz #1009701)
More information about the scm-commits
mailing list