On Wed, Jun 05, 2024 at 04:37:36PM -0400, mgalaxy(a)akamai.com wrote:
From: Michael Galaxy <mgalaxy(a)akamai.com>
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(a)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 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
Does libvirt need more adjustments to support cpr-reboots? I don't
think we have any support for them yet.
+ * 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'"),
Maybe the message could be tweaked a bit to also mention the added
supported case, but that's just a nitpick.
+
virDomainMemorySourceTypeToString(dst->mem.source),
+ virDomainMemorySourceTypeToString(src->mem.source));
+ return false;
+ }
}
for (i = 0; i < src->nmems; i++) {
--
2.34.1