render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
3e5111
From c2cf1aadf957daddd0f7f44aa11d9e2d3f5883c2 Mon Sep 17 00:00:00 2001
3e5111
Message-Id: <c2cf1aadf957daddd0f7f44aa11d9e2d3f5883c2@dist-git>
3e5111
From: Michal Privoznik <mprivozn@redhat.com>
3e5111
Date: Mon, 5 Jun 2017 09:35:24 +0200
3e5111
Subject: [PATCH] virQEMUDriverDomainABIStability: Check for memoryBacking
3e5111
3e5111
https://bugzilla.redhat.com/show_bug.cgi?id=1450349
3e5111
3e5111
Problem is, qemu fails to load guest memory image if these
3e5111
attribute change on migration/restore from an image.
3e5111
3e5111
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
3e5111
(cherry picked from commit 7b4e9b2c55a1105dd96a608d7ee111394da0befc)
3e5111
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
3e5111
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
3e5111
---
3e5111
 src/libvirt_private.syms |  2 ++
3e5111
 src/qemu/qemu_conf.c     |  2 +-
3e5111
 src/qemu/qemu_domain.c   | 22 ++++++++++++++++++++++
3e5111
 src/qemu/qemu_domain.h   |  1 +
3e5111
 4 files changed, 26 insertions(+), 1 deletion(-)
3e5111
3e5111
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
3e5111
index 343966cd0e..a578dfba34 100644
3e5111
--- a/src/libvirt_private.syms
3e5111
+++ b/src/libvirt_private.syms
3e5111
@@ -407,6 +407,8 @@ virDomainMemoryFindByDef;
3e5111
 virDomainMemoryFindInactiveByDef;
3e5111
 virDomainMemoryInsert;
3e5111
 virDomainMemoryRemove;
3e5111
+virDomainMemorySourceTypeFromString;
3e5111
+virDomainMemorySourceTypeToString;
3e5111
 virDomainNetAppendIPAddress;
3e5111
 virDomainNetDefClear;
3e5111
 virDomainNetDefFormat;
3e5111
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
3e5111
index e73a7b3781..76eed25277 100644
3e5111
--- a/src/qemu/qemu_conf.c
3e5111
+++ b/src/qemu/qemu_conf.c
3e5111
@@ -908,7 +908,7 @@ virQEMUDriverCreateXMLConf(virQEMUDriverPtr driver)
3e5111
     return virDomainXMLOptionNew(&virQEMUDriverDomainDefParserConfig,
3e5111
                                  &virQEMUDriverPrivateDataCallbacks,
3e5111
                                  &virQEMUDriverDomainXMLNamespace,
3e5111
-                                 NULL);
3e5111
+                                 &virQEMUDriverDomainABIStability);
3e5111
 }
3e5111
 
3e5111
 
3e5111
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
3e5111
index e5da82aacc..11be085801 100644
3e5111
--- a/src/qemu/qemu_domain.c
3e5111
+++ b/src/qemu/qemu_domain.c
3e5111
@@ -5792,6 +5792,28 @@ qemuDomainUpdateMemoryDeviceInfo(virQEMUDriverPtr driver,
3e5111
 }
3e5111
 
3e5111
 
3e5111
+static bool
3e5111
+qemuDomainABIStabilityCheck(const virDomainDef *src,
3e5111
+                            const virDomainDef *dst)
3e5111
+{
3e5111
+    if (src->mem.source != dst->mem.source) {
3e5111
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
3e5111
+                       _("Target memoryBacking source '%s' doesn't "
3e5111
+                         "match source memoryBacking source'%s'"),
3e5111
+                       virDomainMemorySourceTypeToString(dst->mem.source),
3e5111
+                       virDomainMemorySourceTypeToString(src->mem.source));
3e5111
+        return false;
3e5111
+    }
3e5111
+
3e5111
+    return true;
3e5111
+}
3e5111
+
3e5111
+
3e5111
+virDomainABIStability virQEMUDriverDomainABIStability = {
3e5111
+    .domain = qemuDomainABIStabilityCheck,
3e5111
+};
3e5111
+
3e5111
+
3e5111
 bool
3e5111
 qemuDomainDefCheckABIStability(virQEMUDriverPtr driver,
3e5111
                                virDomainDefPtr src,
3e5111
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
3e5111
index f503304879..2994398a9e 100644
3e5111
--- a/src/qemu/qemu_domain.h
3e5111
+++ b/src/qemu/qemu_domain.h
3e5111
@@ -638,6 +638,7 @@ void qemuDomainCleanupRun(virQEMUDriverPtr driver,
3e5111
 extern virDomainXMLPrivateDataCallbacks virQEMUDriverPrivateDataCallbacks;
3e5111
 extern virDomainXMLNamespace virQEMUDriverDomainXMLNamespace;
3e5111
 extern virDomainDefParserConfig virQEMUDriverDomainDefParserConfig;
3e5111
+extern virDomainABIStability virQEMUDriverDomainABIStability;
3e5111
 
3e5111
 int qemuDomainUpdateDeviceList(virQEMUDriverPtr driver,
3e5111
                                virDomainObjPtr vm, int asyncJob);
3e5111
-- 
3e5111
2.13.1
3e5111