qemu: block: Remove 'active-write' bitmap even if there are no bitmaps to merge

The 'libvirt-tmp-activewrite' bitmap is added during the 'pivot'
operation of block copy and active layer block commit operations
regardless of whether there are any bitmaps to merge, but was not
removed unless a bitmap was merged. This meant that subsequent attempts
to merge into the same image would fail.

Fix it by checking whether the 'libvirt-tmp-activewrite' would be used
by the code and don't skip the code which would delete it.

This is a regression introduced when we switched to the new code for
block commit in <20a7abc2d2d> and for block copy in <7bfff40fdfe5>. The
actual bug originates from <4fa8654ece>.

https://bugzilla.redhat.com/show_bug.cgi?id=1857735

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
Peter Krempa 2020-07-16 14:46:43 +02:00
parent 378e4fbc79
commit 9d039863e2
4 changed files with 29 additions and 1 deletions

View File

@ -2981,7 +2981,7 @@ qemuBlockGetBitmapMergeActions(virStorageSourcePtr topsrc,
if (!(bitmaps = qemuBlockGetBitmapMergeActionsGetBitmaps(topsrc, bitmapname,
blockNamedNodeData)))
return 0;
goto done;
for (next = bitmaps; next; next = next->next) {
const char *curbitmap = next->data;
@ -3038,6 +3038,7 @@ qemuBlockGetBitmapMergeActions(virStorageSourcePtr topsrc,
return -1;
}
done:
if (writebitmapsrc &&
qemuMonitorTransactionBitmapRemove(act, writebitmapsrc->nodeformat,
"libvirt-tmp-activewrite") < 0)

View File

@ -1 +1,10 @@
merge bitmpas:
[
{
"type": "block-dirty-bitmap-remove",
"data": {
"node": "libvirt-2-format",
"name": "libvirt-tmp-activewrite"
}
}
]

View File

@ -0,0 +1,9 @@
[
{
"type": "block-dirty-bitmap-remove",
"data": {
"node": "mirror-format-node",
"name": "libvirt-tmp-activewrite"
}
}
]

View File

@ -0,0 +1,9 @@
[
{
"type": "block-dirty-bitmap-remove",
"data": {
"node": "mirror-format-node",
"name": "libvirt-tmp-activewrite"
}
}
]