[PATCH 4/5] Support live migration between file-backed memory and anonymous memory.

mgalaxy@akamai.com posted 5 patches 7 months, 1 week ago
There is a newer version of this series
[PATCH 4/5] Support live migration between file-backed memory and anonymous memory.
Posted by mgalaxy@akamai.com 7 months, 1 week ago
From: Michael Galaxy <mgalaxy@akamai.com>

In our environment, we need to convert VMs into a live-update-comptabile
configuration "on-the-fly" (via live migration). So, for this very
specific case, this needs to work when PMEM is being enabled. QEMU does
not have a problem with this at all, but we need to relax the rules
here a bit.

Signed-off-by: Michael Galaxy <mgalaxy@akamai.com>
---
 src/qemu/qemu_domain.c | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index de36641137..5f2058c58d 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -8520,11 +8520,25 @@ qemuDomainABIStabilityCheck(const virDomainDef *src,
     size_t i;
 
     if (src->mem.source != dst->mem.source) {
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("Target memoryBacking source '%1$s' doesn't match source memoryBacking source'%2$s'"),
-                       virDomainMemorySourceTypeToString(dst->mem.source),
-                       virDomainMemorySourceTypeToString(src->mem.source));
-        return false;
+	/*
+	 * The current use case for this is the live migration of live-update
+	 * capable CPR guests mounted on PMEM devices at the host
+	 * level (not in-guest PMEM). QEMU has no problem doing these kinds of
+	 * live migrations between these two memory backends, so let them go through.
+	 * This allows us to "upgrade" guests from regular memory to file-backed
+	 * memory seemlessly without taking them down.
+	 */
+	if (!((src->mem.source == VIR_DOMAIN_MEMORY_SOURCE_NONE
+		&& dst->mem.source == VIR_DOMAIN_MEMORY_SOURCE_FILE) ||
+	     (src->mem.source == VIR_DOMAIN_MEMORY_SOURCE_FILE
+	        && dst->mem.source == VIR_DOMAIN_MEMORY_SOURCE_NONE))) {
+
+		virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+			       _("Target memoryBacking source '%1$s' doesn't match source memoryBacking source'%2$s'"),
+			       virDomainMemorySourceTypeToString(dst->mem.source),
+			       virDomainMemorySourceTypeToString(src->mem.source));
+		return false;
+	}
     }
 
     for (i = 0; i < src->nmems; i++) {
-- 
2.25.1
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org