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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>

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

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux