render / rpms / libvirt

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