On Wed, Jul 24, 2019 at 00:56:09 -0500, Eric Blake wrote:
Earlier patches mentioned that the initial implementation will
prevent
snapshots and checkpoints from being used on the same domain at once.
However, the actual restriction is done in this separate patch to make
it easier to lift that restriction via a revert, when we are finally
ready to tackle that integration in the future.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
docs/formatsnapshot.html.in | 4 +++-
src/qemu/qemu_driver.c | 12 ++++++++++++
src/test/test_driver.c | 12 ++++++++++++
tests/virsh-checkpoint | 10 ++++++++++
tests/virsh-snapshot | 10 ++++++++++
tools/virsh.pod | 16 ++++++++++++++++
6 files changed, 63 insertions(+), 1 deletion(-)
[...]
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index d0377d78a9..ca707815d9 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -15749,6 +15749,12 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain,
if (!(vm = qemuDomObjFromDomain(domain)))
goto cleanup;
+ if (virDomainListCheckpoints(vm->checkpoints, NULL, domain, NULL, 0) > 0) {
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+ _("cannot create snapshot while checkpoint exists"));
+ goto cleanup;
+ }
+
cfg = virQEMUDriverGetConfig(driver);
if (virDomainSnapshotCreateXMLEnsureACL(domain->conn, vm->def, flags) < 0)
Note that also any of the block jobs (block pull, block commit) will
mess up the bitmaps thus should be forbidden with checkpoints. Also
block copy has the same problem, but it's questionable whether we'll
want to copy over the bitmaps (which is way easier than with snapshots,
which break if you use that API). If the idea is to eventually be able
to copy bitmaps, then we should also forbid that one until it's
implemented.