- check it is supported by the QEMU - check disk itself has internal snapshot - for modern QEMU select it if it is not specified explicitly Signed-off-by: Nikolay Shirokovskiy <nikolay.shirokovskiy@xxxxxxxxxx> --- src/qemu/qemu_snapshot.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 579d744c60..54eafb5020 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -1852,6 +1852,38 @@ qemuSnapshotCreateAlignDisks(virDomainObj *vm, if (virDomainSnapshotAlignDisks(def, NULL, align_location, true) < 0) return -1; + if (def->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_INTERNAL) { + bool modern = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_SNAPSHOT_SAVE); + + if (modern) { + size_t i; + + for (i = 0; i < def->ndisks; i++) { + if (def->disks[i].snapshot != VIR_DOMAIN_SNAPSHOT_LOCATION_INTERNAL) + continue; + + if (def->memorydisk) { + if (STREQ(def->memorydisk, def->disks[i].name)) + break; + } else { + def->memorydisk = g_strdup(def->disks[i].name); + break; + } + } + + if (i == def->ndisks && def->memorydisk) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, + _("memory disk '%s' should itself have internal snapshot"), + def->memorydisk); + return -1; + } + } else if (def->memorydisk) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("specifing memory disk is not supported by this QEMU")); + return -1; + } + } + return 0; } -- 2.35.1