From b482f451983e159f3e9752c8d4f2f5d36e6e9dce Mon Sep 17 00:00:00 2001 Message-Id: From: Peter Krempa Date: Mon, 16 Mar 2020 22:12:19 +0100 Subject: [PATCH] qemuDomainBlockCommit: Move checks depending on capabilities after liveness check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since capabilities are not present for inactive VMs we'd report that we don't support '--delete' or committing while checkpoints exist rather than the proper error. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake (cherry picked from commit d4b5bb5d56e0ba346a01c605b7316f4394907115) https://bugzilla.redhat.com/show_bug.cgi?id=1799013 Message-Id: <74ee257babd3eb042be2fcc5d3a101d503b99ad2.1584391727.git.pkrempa@redhat.com> Reviewed-by: Ján Tomko --- src/qemu/qemu_driver.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 441bb02b6b..062e028b28 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -18738,9 +18738,6 @@ qemuDomainBlockCommit(virDomainPtr dom, if (virDomainBlockCommitEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainSupportsCheckpointsBlockjobs(vm) < 0) - goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) goto cleanup; @@ -18749,12 +18746,6 @@ qemuDomainBlockCommit(virDomainPtr dom, blockdev = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV); - if (!blockdev && (flags & VIR_DOMAIN_BLOCK_COMMIT_DELETE)) { - virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", - _("deleting committed images is not supported by this VM")); - goto endjob; - } - /* Convert bandwidth MiB to bytes, if necessary */ if (!(flags & VIR_DOMAIN_BLOCK_COMMIT_BANDWIDTH_BYTES)) { if (speed > LLONG_MAX >> 20) { @@ -18779,6 +18770,15 @@ qemuDomainBlockCommit(virDomainPtr dom, if (qemuDomainDiskBlockJobIsActive(disk)) goto endjob; + if (qemuDomainSupportsCheckpointsBlockjobs(vm) < 0) + goto endjob; + + if (!blockdev && (flags & VIR_DOMAIN_BLOCK_COMMIT_DELETE)) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("deleting committed images is not supported by this VM")); + goto endjob; + } + if (!top || STREQ(top, disk->dst)) topSource = disk->src; else if (virStorageFileParseChainIndex(disk->dst, top, &topIndex) < 0 || -- 2.25.1