qemu: Move interlocking of blockjobs and checkpoints after liveness check

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>
This commit is contained in:
Peter Krempa 2020-04-17 10:58:08 +02:00
parent b37fdfb9d4
commit bef10f6eaa

View 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);
}