Blame SOURCES/libvirt-qemuDomainBlockPivot-Handle-merging-of-bitmaps-when-pivoting-an-active-block-commit.patch

a41c76
From fa5d6a3c048e15f466a5bd2f7cc6de0b106d69a2 Mon Sep 17 00:00:00 2001
a41c76
Message-Id: <fa5d6a3c048e15f466a5bd2f7cc6de0b106d69a2@dist-git>
a41c76
From: Peter Krempa <pkrempa@redhat.com>
a41c76
Date: Mon, 16 Mar 2020 22:12:30 +0100
a41c76
Subject: [PATCH] qemuDomainBlockPivot: Handle merging of bitmaps when pivoting
a41c76
 an active block-commit
a41c76
MIME-Version: 1.0
a41c76
Content-Type: text/plain; charset=UTF-8
a41c76
Content-Transfer-Encoding: 8bit
a41c76
a41c76
Active layer block commit makes the 'base' image the new top image of
a41c76
the disk after it finishes. This means that all bitmap operations need
a41c76
to be handled prior to this happening as we'd lose writes otherwise.
a41c76
a41c76
The ideal place is to handle it when pivoting to the new image as only
a41c76
guest-writes would be happening after this point.
a41c76
a41c76
Use qemuBlockBitmapsHandleCommitFinish to calculate the merging
a41c76
transaction.
a41c76
a41c76
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
a41c76
Reviewed-by: Eric Blake <eblake@redhat.com>
a41c76
(cherry picked from commit 8502b4b0595ac040f22e1ec8c2ab6375506c14a3)
a41c76
https://bugzilla.redhat.com/show_bug.cgi?id=1799013
a41c76
Message-Id: <7fbaf9f9a8533489334c5b08e6451b23011ab657.1584391727.git.pkrempa@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
---
a41c76
 src/qemu/qemu_driver.c | 17 +++++++++++++++++
a41c76
 1 file changed, 17 insertions(+)
a41c76
a41c76
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
a41c76
index 2f8fee2ef0..05e525e935 100644
a41c76
--- a/src/qemu/qemu_driver.c
a41c76
+++ b/src/qemu/qemu_driver.c
a41c76
@@ -17626,6 +17626,23 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver,
a41c76
         break;
a41c76
 
a41c76
     case QEMU_BLOCKJOB_TYPE_ACTIVE_COMMIT:
a41c76
+        /* we technically don't need reopen here, but we couldn't prepare
a41c76
+         * the bitmaps if it wasn't present thus must skip this */
a41c76
+        if (blockdev &&
a41c76
+            virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN)) {
a41c76
+            g_autoptr(virHashTable) blockNamedNodeData = NULL;
a41c76
+
a41c76
+            if (!(blockNamedNodeData = qemuBlockGetNamedNodeData(vm, QEMU_ASYNC_JOB_NONE)))
a41c76
+                return -1;
a41c76
+
a41c76
+            if (qemuBlockBitmapsHandleCommitFinish(job->data.commit.top,
a41c76
+                                                   job->data.commit.base,
a41c76
+                                                   blockNamedNodeData,
a41c76
+                                                   &actions,
a41c76
+                                                   job->data.commit.disabledBitmapsBase) < 0)
a41c76
+                return -1;
a41c76
+        }
a41c76
+
a41c76
         break;
a41c76
     }
a41c76
 
a41c76
-- 
a41c76
2.25.1
a41c76