render / rpms / libvirt

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