render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
7cf89a
From b90b606deb02320044248c8ce6727dc6ddb0a939 Mon Sep 17 00:00:00 2001
7cf89a
Message-Id: <b90b606deb02320044248c8ce6727dc6ddb0a939@dist-git>
7cf89a
From: Michal Privoznik <mprivozn@redhat.com>
7cf89a
Date: Fri, 21 Aug 2015 10:50:56 -0700
7cf89a
Subject: [PATCH] qemu: Use correct flags for ABI stability check in
7cf89a
 SaveImageUpdateDef
7cf89a
7cf89a
https://bugzilla.redhat.com/show_bug.cgi?id=1183869 [7.2.0]
7cf89a
https://bugzilla.redhat.com/show_bug.cgi?id=1254164 [7.2.0]
7cf89a
https://bugzilla.redhat.com/show_bug.cgi?id=1255859 [7.1.z]
7cf89a
7cf89a
Soo. you've successfully started yourself a domain. And since you want
7cf89a
to use it on your host exclusively you are confident enough to
7cf89a
passthrough the host CPU model, like this:
7cf89a
7cf89a
  <cpu mode='host-passthrough'/>
7cf89a
7cf89a
Then, after a while, you want to save the domain into a file (e.g.
7cf89a
virsh save dom dom.save). And here comes the trouble. The file consist
7cf89a
of two parts: Libvirt header (containing domain XML among other
7cf89a
things), and qemu migration data. Now, the domain XML in the header is
7cf89a
formatted using special flags (VIR_DOMAIN_XML_SECURE |
7cf89a
VIR_DOMAIN_XML_UPDATE_CPU | VIR_DOMAIN_XML_INACTIVE |
7cf89a
VIR_DOMAIN_XML_MIGRATABLE).
7cf89a
7cf89a
Then, on your way back from the bar, you think of changing something
7cf89a
in the XML in the saved file (we have a command for it after all), say
7cf89a
listen address for graphics console. So you successfully type in the
7cf89a
command:
7cf89a
7cf89a
  virsh save-image-edit dom.save
7cf89a
7cf89a
Change all the bits, and exit the editor. But instead of success
7cf89a
you're left with sad error message:
7cf89a
7cf89a
  error: unsupported configuration: Target CPU model <null> does not
7cf89a
  match source Pentium Pro
7cf89a
7cf89a
Sigh. Digging into the code you see lines, where we check for ABI
7cf89a
stability. The new XML you've produced is compared with the old one
7cf89a
from the saved file to see if qemu ABI will break or not. Wait, what?
7cf89a
We are using different flags to parse the XML you've provided so we
7cf89a
were just lucky it worked in some cases? Yep, that's right.
7cf89a
7cf89a
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7cf89a
(cherry picked from commit cf2d4c603c37a58c7c6cacc87f0e78b45903ae7c)
7cf89a
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7cf89a
---
7cf89a
 src/qemu/qemu_driver.c | 4 ++--
7cf89a
 1 file changed, 2 insertions(+), 2 deletions(-)
7cf89a
7cf89a
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
7cf89a
index 425cf90..299cf7b 100644
7cf89a
--- a/src/qemu/qemu_driver.c
7cf89a
+++ b/src/qemu/qemu_driver.c
7cf89a
@@ -5856,8 +5856,8 @@ qemuDomainSaveImageUpdateDef(virQEMUDriverPtr driver,
7cf89a
 
7cf89a
     if (!(newdef_migr = qemuDomainDefCopy(driver,
7cf89a
                                           newdef,
7cf89a
-                                          VIR_DOMAIN_XML_MIGRATABLE |
7cf89a
-                                          VIR_DOMAIN_XML_SECURE)))
7cf89a
+                                          QEMU_DOMAIN_FORMAT_LIVE_FLAGS ||
7cf89a
+                                          VIR_DOMAIN_XML_MIGRATABLE)))
7cf89a
         goto cleanup;
7cf89a
 
7cf89a
     if (!virDomainDefCheckABIStability(def, newdef_migr)) {
7cf89a
-- 
7cf89a
2.5.0
7cf89a