[PATCH 1/5] qemu: blockjob: Don't base bitmap handling of active-layer block commit on QEMU_CAPS_BLOCKDEV_REOPEN

Peter Krempa posted 5 patches 4 years, 4 months ago
[PATCH 1/5] qemu: blockjob: Don't base bitmap handling of active-layer block commit on QEMU_CAPS_BLOCKDEV_REOPEN
Posted by Peter Krempa 4 years, 4 months ago
The handler finalizing the active layer block commit doesn't actually
reopen the file for active layer block commit, so the comment and check
are invalid.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 src/qemu/qemu_blockjob.c | 3 ++-
 src/qemu/qemu_driver.c   | 6 +-----
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
index 0039bc0e9f..9b78733c53 100644
--- a/src/qemu/qemu_blockjob.c
+++ b/src/qemu/qemu_blockjob.c
@@ -1101,7 +1101,8 @@ qemuBlockJobProcessEventCompletedCommitBitmaps(virDomainObjPtr vm,
     g_autoptr(virJSONValue) actions = NULL;
     bool active = job->type == QEMU_BLOCKJOB_TYPE_ACTIVE_COMMIT;

-    if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN))
+    if (!active &&
+        !virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN))
         return 0;

     if (!(blockNamedNodeData = qemuBlockGetNamedNodeData(vm, asyncJob)))
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index d185666ed8..f5074cb151 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -17386,11 +17386,7 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver,
         break;

     case QEMU_BLOCKJOB_TYPE_ACTIVE_COMMIT:
-        /* we technically don't need reopen here, but we couldn't prepare
-         * the bitmaps if it wasn't present thus must skip this */
-        if (blockdev &&
-            virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN)) {
-
+        if (blockdev) {
             actions = virJSONValueNewArray();

             if (qemuMonitorTransactionBitmapAdd(actions,
-- 
2.26.2

Re: [PATCH 1/5] qemu: blockjob: Don't base bitmap handling of active-layer block commit on QEMU_CAPS_BLOCKDEV_REOPEN
Posted by Eric Blake 4 years, 4 months ago
On 7/16/20 9:20 AM, Peter Krempa wrote:
> The handler finalizing the active layer block commit doesn't actually
> reopen the file for active layer block commit, so the comment and check
> are invalid.
> 
> Signed-off-by: Peter Krempa <pkrempa@redhat.com>
> ---
>   src/qemu/qemu_blockjob.c | 3 ++-
>   src/qemu/qemu_driver.c   | 6 +-----
>   2 files changed, 3 insertions(+), 6 deletions(-)
> 

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org