render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
79b470
From cb297cdd8dc75abc8fd0d60dddf54cbe305d4c14 Mon Sep 17 00:00:00 2001
79b470
Message-Id: <cb297cdd8dc75abc8fd0d60dddf54cbe305d4c14@dist-git>
79b470
From: Peter Krempa <pkrempa@redhat.com>
79b470
Date: Tue, 21 Jul 2020 13:56:23 +0200
79b470
Subject: [PATCH] qemu: block: Remove 'active-write' bitmap even if there are
79b470
 no bitmaps to merge
79b470
79b470
The 'libvirt-tmp-activewrite' bitmap is added during the 'pivot'
79b470
operation of block copy and active layer block commit operations
79b470
regardless of whether there are any bitmaps to merge, but was not
79b470
removed unless a bitmap was merged. This meant that subsequent attempts
79b470
to merge into the same image would fail.
79b470
79b470
Fix it by checking whether the 'libvirt-tmp-activewrite' would be used
79b470
by the code and don't skip the code which would delete it.
79b470
79b470
This is a regression introduced when we switched to the new code for
79b470
block commit in <20a7abc2d2d> and for block copy in <7bfff40fdfe5>. The
79b470
actual bug originates from <4fa8654ece>.
79b470
79b470
https://bugzilla.redhat.com/show_bug.cgi?id=1857735
79b470
79b470
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
79b470
Reviewed-by: Eric Blake <eblake@redhat.com>
79b470
(cherry picked from commit 9d039863e2cae227cc73b7a886b40be5e5218a12)
79b470
79b470
rhel-8.3: https://bugzilla.redhat.com/show_bug.cgi?id=1857779
79b470
rhel-av-8.2.1: not cloned yet
79b470
Message-Id: <4fea6a40be534d5a6fe7aad88d6bee1c3e77dcfb.1595332476.git.pkrempa@redhat.com>
79b470
79b470
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
79b470
---
79b470
 src/qemu/qemu_block.c                                    | 3 ++-
79b470
 tests/qemublocktestdata/bitmapblockcommit/empty          | 9 +++++++++
79b470
 .../bitmapblockcopy/empty-deep-out.json                  | 9 +++++++++
79b470
 .../bitmapblockcopy/empty-shallow-out.json               | 9 +++++++++
79b470
 4 files changed, 29 insertions(+), 1 deletion(-)
79b470
79b470
diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
79b470
index 18c3861a2e..dc5fa3da03 100644
79b470
--- a/src/qemu/qemu_block.c
79b470
+++ b/src/qemu/qemu_block.c
79b470
@@ -2935,7 +2935,7 @@ qemuBlockGetBitmapMergeActions(virStorageSourcePtr topsrc,
79b470
 
79b470
     if (!(bitmaps = qemuBlockGetBitmapMergeActionsGetBitmaps(topsrc, bitmapname,
79b470
                                                              blockNamedNodeData)))
79b470
-        return 0;
79b470
+        goto done;
79b470
 
79b470
     for (next = bitmaps; next; next = next->next) {
79b470
         const char *curbitmap = next->data;
79b470
@@ -2992,6 +2992,7 @@ qemuBlockGetBitmapMergeActions(virStorageSourcePtr topsrc,
79b470
             return -1;
79b470
     }
79b470
 
79b470
+ done:
79b470
     if (writebitmapsrc &&
79b470
         qemuMonitorTransactionBitmapRemove(act, writebitmapsrc->nodeformat,
79b470
                                            "libvirt-tmp-activewrite") < 0)
79b470
diff --git a/tests/qemublocktestdata/bitmapblockcommit/empty b/tests/qemublocktestdata/bitmapblockcommit/empty
79b470
index 9260011852..eddef0ddcd 100644
79b470
--- a/tests/qemublocktestdata/bitmapblockcommit/empty
79b470
+++ b/tests/qemublocktestdata/bitmapblockcommit/empty
79b470
@@ -1 +1,10 @@
79b470
 merge bitmpas:
79b470
+[
79b470
+  {
79b470
+    "type": "block-dirty-bitmap-remove",
79b470
+    "data": {
79b470
+      "node": "libvirt-2-format",
79b470
+      "name": "libvirt-tmp-activewrite"
79b470
+    }
79b470
+  }
79b470
+]
79b470
diff --git a/tests/qemublocktestdata/bitmapblockcopy/empty-deep-out.json b/tests/qemublocktestdata/bitmapblockcopy/empty-deep-out.json
79b470
index e69de29bb2..99f2589ed4 100644
79b470
--- a/tests/qemublocktestdata/bitmapblockcopy/empty-deep-out.json
79b470
+++ b/tests/qemublocktestdata/bitmapblockcopy/empty-deep-out.json
79b470
@@ -0,0 +1,9 @@
79b470
+[
79b470
+  {
79b470
+    "type": "block-dirty-bitmap-remove",
79b470
+    "data": {
79b470
+      "node": "mirror-format-node",
79b470
+      "name": "libvirt-tmp-activewrite"
79b470
+    }
79b470
+  }
79b470
+]
79b470
diff --git a/tests/qemublocktestdata/bitmapblockcopy/empty-shallow-out.json b/tests/qemublocktestdata/bitmapblockcopy/empty-shallow-out.json
79b470
index e69de29bb2..99f2589ed4 100644
79b470
--- a/tests/qemublocktestdata/bitmapblockcopy/empty-shallow-out.json
79b470
+++ b/tests/qemublocktestdata/bitmapblockcopy/empty-shallow-out.json
79b470
@@ -0,0 +1,9 @@
79b470
+[
79b470
+  {
79b470
+    "type": "block-dirty-bitmap-remove",
79b470
+    "data": {
79b470
+      "node": "mirror-format-node",
79b470
+      "name": "libvirt-tmp-activewrite"
79b470
+    }
79b470
+  }
79b470
+]
79b470
-- 
79b470
2.27.0
79b470