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

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