[libvirt] [PATCH v10 19/19] backup: Prevent snapshots and checkpoints at same time

Peter Krempa pkrempa at redhat.com
Wed Jul 24 15:40:14 UTC 2019


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 at 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190724/47c1632c/attachment-0001.sig>


More information about the libvir-list mailing list