]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Move interlocking of blockjobs and checkpoints after liveness check
authorPeter Krempa <pkrempa@redhat.com>
Fri, 17 Apr 2020 08:58:08 +0000 (10:58 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 24 Apr 2020 06:57:14 +0000 (08:57 +0200)
qemuDomainSupportsCheckpointsBlockjobs checks if the
QEMU_CAPS_INCREMENTAL_BACKUP capability is supported to do the
interlocking. Capabilities are not present when the VM isn't running
though which would create false errors.

Move the checks after the liveness check in block job implementations.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Pavel Mores <pmores@redhat.com>
src/qemu/qemu_driver.c

index 5ff4ee7389a695d3632151bfe7be0f28df039036..01330e55e78f683544afe29574ebe01a77764db2 100644 (file)
@@ -17440,6 +17440,9 @@ qemuDomainBlockPullCommon(virDomainObjPtr vm,
     if (virDomainObjCheckActive(vm) < 0)
         goto endjob;
 
+    if (qemuDomainSupportsCheckpointsBlockjobs(vm) < 0)
+        goto endjob;
+
     if (!(disk = qemuDomainDiskByName(vm->def, path)))
         goto endjob;
 
@@ -17995,6 +17998,9 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
     if (virDomainObjCheckActive(vm) < 0)
         goto endjob;
 
+    if (qemuDomainSupportsCheckpointsBlockjobs(vm) < 0)
+        goto endjob;
+
     if (!(disk = qemuDomainDiskByName(vm->def, path)))
         goto endjob;
 
@@ -18279,9 +18285,6 @@ qemuDomainBlockRebase(virDomainPtr dom, const char *path, const char *base,
     if (virDomainBlockRebaseEnsureACL(dom->conn, vm->def) < 0)
         goto cleanup;
 
-    if (qemuDomainSupportsCheckpointsBlockjobs(vm) < 0)
-        goto cleanup;
-
     /* For normal rebase (enhanced blockpull), the common code handles
      * everything, including vm cleanup. */
     if (!(flags & VIR_DOMAIN_BLOCK_REBASE_COPY))
@@ -18365,9 +18368,6 @@ qemuDomainBlockCopy(virDomainPtr dom, const char *disk, const char *destxml,
     if (virDomainBlockCopyEnsureACL(dom->conn, vm->def) < 0)
         goto cleanup;
 
-    if (qemuDomainSupportsCheckpointsBlockjobs(vm) < 0)
-        goto cleanup;
-
     for (i = 0; i < nparams; i++) {
         virTypedParameterPtr param = &params[i];
 
@@ -18430,11 +18430,6 @@ qemuDomainBlockPull(virDomainPtr dom, const char *path, unsigned long bandwidth,
         return -1;
     }
 
-    if (qemuDomainSupportsCheckpointsBlockjobs(vm) < 0) {
-        virDomainObjEndAPI(&vm);
-        return -1;
-    }
-
     /* qemuDomainBlockPullCommon consumes the reference on @vm */
     return qemuDomainBlockPullCommon(vm, path, NULL, bandwidth, flags);
 }