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

Eric Blake eblake at redhat.com
Fri Jul 26 21:09:44 UTC 2019


On 7/24/19 10:40 AM, Peter Krempa wrote:
> 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>

>>
>>      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.

Here's what I'm squashing in to this patch. I've made a few other
adjustments through the series based on review comments and my
last-minute once-over, and am now pushing this series; any further
changes will need to be followup patches.

diff --git i/src/qemu/qemu_driver.c w/src/qemu/qemu_driver.c
index 3e29e54cea..8fa928afc1 100644
--- i/src/qemu/qemu_driver.c
+++ w/src/qemu/qemu_driver.c
@@ -18476,6 +18476,12 @@ qemuDomainBlockRebase(virDomainPtr dom, const
char *path, const char *base,
     if (virDomainBlockRebaseEnsureACL(dom->conn, vm->def) < 0)
         goto cleanup;

+    if (virDomainListCheckpoints(vm->checkpoints, NULL, dom, NULL, 0) >
0) {
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+                       _("cannot perform block rebase while checkpoint
exists"));
+        goto cleanup;
+    }
+
     /* For normal rebase (enhanced blockpull), the common code handles
      * everything, including vm cleanup. */
     if (!(flags & VIR_DOMAIN_BLOCK_REBASE_COPY))
@@ -18560,6 +18566,12 @@ qemuDomainBlockCopy(virDomainPtr dom, const
char *disk, const char *destxml,
     if (virDomainBlockCopyEnsureACL(dom->conn, vm->def) < 0)
         goto cleanup;

+    if (virDomainListCheckpoints(vm->checkpoints, NULL, dom, NULL, 0) >
0) {
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+                       _("cannot perform block copy while checkpoint
exists"));
+        goto cleanup;
+    }
+
     for (i = 0; i < nparams; i++) {
         virTypedParameterPtr param = &params[i];

@@ -18622,6 +18634,13 @@ qemuDomainBlockPull(virDomainPtr dom, const
char *path, unsigned long bandwidth,
         return -1;
     }

+    if (virDomainListCheckpoints(vm->checkpoints, NULL, dom, NULL, 0) >
0) {
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+                       _("cannot perform block pull while checkpoint
exists"));
+        virDomainObjEndAPI(&vm);
+        return -1;
+    }
+
     return qemuDomainBlockPullCommon(dom->conn->privateData,
                                      vm, path, NULL, bandwidth, flags);
 }
@@ -18668,6 +18687,12 @@ qemuDomainBlockCommit(virDomainPtr dom,
     if (virDomainBlockCommitEnsureACL(dom->conn, vm->def) < 0)
         goto cleanup;

+    if (virDomainListCheckpoints(vm->checkpoints, NULL, dom, NULL, 0) >
0) {
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+                       _("cannot perform block commit while checkpoint
exists"));
+        goto cleanup;
+    }
+
     if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
         goto cleanup;



-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190726/c5ca7daa/attachment-0001.sig>


More information about the libvir-list mailing list