Blame SOURCES/libvirt-qemuCheckpointDiscardBitmaps-Reopen-images-for-bitmap-modifications.patch

d76c62
From 74ee4616dd3159f4456ec9d4fd22b4604394440b Mon Sep 17 00:00:00 2001
d76c62
Message-Id: <74ee4616dd3159f4456ec9d4fd22b4604394440b@dist-git>
d76c62
From: Peter Krempa <pkrempa@redhat.com>
d76c62
Date: Mon, 16 Mar 2020 22:12:17 +0100
d76c62
Subject: [PATCH] qemuCheckpointDiscardBitmaps: Reopen images for bitmap
d76c62
 modifications
d76c62
MIME-Version: 1.0
d76c62
Content-Type: text/plain; charset=UTF-8
d76c62
Content-Transfer-Encoding: 8bit
d76c62
d76c62
Qemu's bitmap APIs don't reopen the appropriate images read-write for
d76c62
modification. It's libvirt's duty to reopen them via blockdev-reopen
d76c62
if we wish to modify the bitmaps.
d76c62
d76c62
Use the new helpers to reopen the images for bitmap manipulation.
d76c62
d76c62
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
d76c62
Reviewed-by: Eric Blake <eblake@redhat.com>
d76c62
(cherry picked from commit c6d117528cc0ddb325abd67d69b6d4ebc1bfe608)
d76c62
https://bugzilla.redhat.com/show_bug.cgi?id=1799013
d76c62
Message-Id: <c5378d64ab79d29e62b5b65d1566825b5bc88eff.1584391727.git.pkrempa@redhat.com>
d76c62
Reviewed-by: Ján Tomko <jtomko@redhat.com>
d76c62
---
d76c62
 src/qemu/qemu_checkpoint.c | 7 +++++++
d76c62
 1 file changed, 7 insertions(+)
d76c62
d76c62
diff --git a/src/qemu/qemu_checkpoint.c b/src/qemu/qemu_checkpoint.c
d76c62
index fe54af74ec..6e3a432022 100644
d76c62
--- a/src/qemu/qemu_checkpoint.c
d76c62
+++ b/src/qemu/qemu_checkpoint.c
d76c62
@@ -302,6 +302,10 @@ qemuCheckpointDiscardBitmaps(virDomainObjPtr vm,
d76c62
                                                false, false, false) < 0)
d76c62
             goto relabel;
d76c62
 
d76c62
+        if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN) &&
d76c62
+            qemuBlockReopenReadWrite(vm, src, QEMU_ASYNC_JOB_NONE) < 0)
d76c62
+            goto relabel;
d76c62
+
d76c62
         relabelimages = g_slist_prepend(relabelimages, src);
d76c62
     }
d76c62
 
d76c62
@@ -314,6 +318,9 @@ qemuCheckpointDiscardBitmaps(virDomainObjPtr vm,
d76c62
     for (next = relabelimages; next; next = next->next) {
d76c62
         virStorageSourcePtr src = next->data;
d76c62
 
d76c62
+        if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN))
d76c62
+            ignore_value(qemuBlockReopenReadOnly(vm, src, QEMU_ASYNC_JOB_NONE));
d76c62
+
d76c62
         ignore_value(qemuDomainStorageSourceAccessAllow(driver, vm, src,
d76c62
                                                         true, false, false));
d76c62
     }
d76c62
-- 
d76c62
2.25.1
d76c62