From bef10f6eaa93db649c36468143ce6556444a2e25 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Fri, 17 Apr 2020 10:58:08 +0200 Subject: [PATCH] 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 Reviewed-by: Eric Blake Reviewed-by: Pavel Mores --- src/qemu/qemu_driver.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 5ff4ee7389..01330e55e7 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -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 = ¶ms[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); }