render / rpms / libvirt

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