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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Michael Galaxy <mgalaxy@xxxxxxxxxx>

In our environment, we need to convert VMs into a live-update-comptabile
configuration "on-the-fly" (via live migration). More specifically: We
need to convert between anonymous memory-backed VMs and file-backed
memory VMs. So, for this very specific case, this needs to work when
host-level PMEM is being enabled. QEMU does not have a problem with this
at all, but we need to relax the rules here a bit so that libvirt allows
it to go through normally.

Signed-off-by: Michael Galaxy <mgalaxy@xxxxxxxxxx>
---
 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 bda62f2e5c..93e98f8dae 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -8641,11 +8641,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.34.1



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux