* [PULL 0/3] block bitmaps patches for rc1, 2021-07-21
@ 2021-07-21 19:47 Eric Blake
2021-07-21 19:47 ` [PULL 1/3] iotests: Improve and rename test 291 to qemu-img-bitmap Eric Blake
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Eric Blake @ 2021-07-21 19:47 UTC (permalink / raw)
To: qemu-devel
The following changes since commit e77c8b8b8e933414ef07dbed04e02973fccffeb0:
Update version for v6.1.0-rc0 release (2021-07-21 17:10:15 +0100)
are available in the Git repository at:
https://repo.or.cz/qemu/ericb.git tags/pull-bitmaps-2021-07-21
for you to fetch changes up to 955171e4417bf39edb5503e694501e082a757731:
qemu-img: Add --skip-broken-bitmaps for 'convert --bitmaps' (2021-07-21 14:14:41 -0500)
----------------------------------------------------------------
block bitmaps patches for 2021-07-21
- fix 'qemu-img convert --bitmaps' handling of qcow2 files with
inconsistent bitmaps
----------------------------------------------------------------
Eric Blake (3):
iotests: Improve and rename test 291 to qemu-img-bitmap
qemu-img: Fail fast on convert --bitmaps with inconsistent bitmap
qemu-img: Add --skip-broken-bitmaps for 'convert --bitmaps'
docs/tools/qemu-img.rst | 8 ++-
block/dirty-bitmap.c | 2 +-
qemu-img.c | 50 ++++++++++++++--
tests/qemu-iotests/{291 => tests/qemu-img-bitmaps} | 34 ++++++++++-
.../{291.out => tests/qemu-img-bitmaps.out} | 67 +++++++++++++++++++++-
5 files changed, 152 insertions(+), 9 deletions(-)
rename tests/qemu-iotests/{291 => tests/qemu-img-bitmaps} (79%)
rename tests/qemu-iotests/{291.out => tests/qemu-img-bitmaps.out} (70%)
--
2.31.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PULL 1/3] iotests: Improve and rename test 291 to qemu-img-bitmap
2021-07-21 19:47 [PULL 0/3] block bitmaps patches for rc1, 2021-07-21 Eric Blake
@ 2021-07-21 19:47 ` Eric Blake
2021-07-21 19:47 ` [PULL 2/3] qemu-img: Fail fast on convert --bitmaps with inconsistent bitmap Eric Blake
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Eric Blake @ 2021-07-21 19:47 UTC (permalink / raw)
To: qemu-devel
Cc: Kevin Wolf, Vladimir Sementsov-Ogievskiy, open list:Dirty Bitmaps,
Max Reitz, Nir Soffer, John Snow
Enhance the test to demonstrate existing less-than-stellar behavior of
qemu-img with a qcow2 image containing an inconsistent bitmap: we
don't diagnose the problem until after copying the entire image (a
potentially long time), and when we do diagnose the failure, we still
end up leaving an empty bitmap in the destination. This mess will be
cleaned up in the next patch.
While at it, rename the test now that we support useful iotest names,
and fix a missing newline in the error message thus exposed.
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20210709153951.2801666-2-eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Nir Soffer <nsoffer@redhat.com>
---
block/dirty-bitmap.c | 2 +-
.../{291 => tests/qemu-img-bitmaps} | 21 +++++++-
.../{291.out => tests/qemu-img-bitmaps.out} | 49 ++++++++++++++++++-
3 files changed, 69 insertions(+), 3 deletions(-)
rename tests/qemu-iotests/{291 => tests/qemu-img-bitmaps} (87%)
rename tests/qemu-iotests/{291.out => tests/qemu-img-bitmaps.out} (76%)
diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c
index 68d295d6e3ed..0ef46163e3ea 100644
--- a/block/dirty-bitmap.c
+++ b/block/dirty-bitmap.c
@@ -193,7 +193,7 @@ int bdrv_dirty_bitmap_check(const BdrvDirtyBitmap *bitmap, uint32_t flags,
error_setg(errp, "Bitmap '%s' is inconsistent and cannot be used",
bitmap->name);
error_append_hint(errp, "Try block-dirty-bitmap-remove to delete"
- " this bitmap from disk");
+ " this bitmap from disk\n");
return -1;
}
diff --git a/tests/qemu-iotests/291 b/tests/qemu-iotests/tests/qemu-img-bitmaps
similarity index 87%
rename from tests/qemu-iotests/291
rename to tests/qemu-iotests/tests/qemu-img-bitmaps
index 20efb080a6c0..409c4497a303 100755
--- a/tests/qemu-iotests/291
+++ b/tests/qemu-iotests/tests/qemu-img-bitmaps
@@ -3,7 +3,7 @@
#
# Test qemu-img bitmap handling
#
-# Copyright (C) 2018-2020 Red Hat, Inc.
+# Copyright (C) 2018-2021 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,11 +27,13 @@ status=1 # failure is the default!
_cleanup()
{
_cleanup_test_img
+ _rm_test_img "$TEST_IMG.copy"
nbd_server_stop
}
trap "_cleanup; exit \$status" 0 1 2 3 15
# get standard environment, filters and checks
+cd ..
. ./common.rc
. ./common.filter
. ./common.nbd
@@ -129,6 +131,23 @@ $QEMU_IMG map --output=json --image-opts \
nbd_server_stop
+echo
+echo "=== Check handling of inconsistent bitmap ==="
+echo
+
+# Prepare image with corrupted bitmap
+$QEMU_IO -c abort "$TEST_IMG" 2>/dev/null
+$QEMU_IMG bitmap --add "$TEST_IMG" b4
+$QEMU_IMG bitmap --remove "$TEST_IMG" b1
+_img_info --format-specific | _filter_irrelevant_img_info
+echo
+$QEMU_IMG convert --bitmaps -O qcow2 "$TEST_IMG" "$TEST_IMG.copy" &&
+ echo "unexpected success"
+# Bug - even though we failed at conversion, we left a file around with
+# a bitmap marked as not corrupt
+TEST_IMG=$TEST_IMG.copy _img_info --format-specific \
+ | _filter_irrelevant_img_info
+
# success, all done
echo '*** done'
rm -f $seq.full
diff --git a/tests/qemu-iotests/291.out b/tests/qemu-iotests/tests/qemu-img-bitmaps.out
similarity index 76%
rename from tests/qemu-iotests/291.out
rename to tests/qemu-iotests/tests/qemu-img-bitmaps.out
index 018d6b103f87..6824d4112893 100644
--- a/tests/qemu-iotests/291.out
+++ b/tests/qemu-iotests/tests/qemu-img-bitmaps.out
@@ -1,4 +1,4 @@
-QA output created by 291
+QA output created by qemu-img-bitmaps
=== Initial image setup ===
@@ -115,4 +115,51 @@ Format specific information:
[{ "start": 0, "length": 2097152, "depth": 0, "present": true, "zero": false, "data": true, "offset": OFFSET},
{ "start": 2097152, "length": 1048576, "depth": 0, "present": false, "zero": false, "data": false},
{ "start": 3145728, "length": 7340032, "depth": 0, "present": true, "zero": false, "data": true, "offset": OFFSET}]
+
+=== Check handling of inconsistent bitmap ===
+
+image: TEST_DIR/t.IMGFMT
+file format: IMGFMT
+virtual size: 10 MiB (10485760 bytes)
+cluster_size: 65536
+backing file: TEST_DIR/t.IMGFMT.base
+backing file format: IMGFMT
+Format specific information:
+ bitmaps:
+ [0]:
+ flags:
+ [0]: in-use
+ [1]: auto
+ name: b2
+ granularity: 65536
+ [1]:
+ flags:
+ [0]: in-use
+ name: b0
+ granularity: 65536
+ [2]:
+ flags:
+ [0]: auto
+ name: b4
+ granularity: 65536
+ corrupt: false
+
+qemu-img: Failed to populate bitmap b0: Bitmap 'b0' is inconsistent and cannot be used
+Try block-dirty-bitmap-remove to delete this bitmap from disk
+image: TEST_DIR/t.IMGFMT.copy
+file format: IMGFMT
+virtual size: 10 MiB (10485760 bytes)
+cluster_size: 65536
+Format specific information:
+ bitmaps:
+ [0]:
+ flags:
+ name: b0
+ granularity: 65536
+ [1]:
+ flags:
+ [0]: auto
+ name: b4
+ granularity: 65536
+ corrupt: false
*** done
--
2.31.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PULL 2/3] qemu-img: Fail fast on convert --bitmaps with inconsistent bitmap
2021-07-21 19:47 [PULL 0/3] block bitmaps patches for rc1, 2021-07-21 Eric Blake
2021-07-21 19:47 ` [PULL 1/3] iotests: Improve and rename test 291 to qemu-img-bitmap Eric Blake
@ 2021-07-21 19:47 ` Eric Blake
2021-07-21 19:47 ` [PULL 3/3] qemu-img: Add --skip-broken-bitmaps for 'convert --bitmaps' Eric Blake
2021-07-22 13:00 ` [PULL 0/3] block bitmaps patches for rc1, 2021-07-21 Peter Maydell
3 siblings, 0 replies; 5+ messages in thread
From: Eric Blake @ 2021-07-21 19:47 UTC (permalink / raw)
To: qemu-devel
Cc: Nir Soffer, Kevin Wolf, Vladimir Sementsov-Ogievskiy,
open list:Block layer core, Max Reitz
Waiting until the end of the convert operation (a potentially
time-consuming task) to finally detect that we can't copy a bitmap is
bad, comparing to failing fast up front. Furthermore, this prevents
us from leaving a file behind with a bitmap that is not marked as
inconsistent even though it does not have sane contents.
This fixes the problems exposed in the previous patch to the iotest:
it adds a fast failure up front, and even if we don't fail early, it
ensures that any bitmap we add but do not properly populate is removed
again rather than left behind incomplete.
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20210709153951.2801666-3-eblake@redhat.com>
[eblake: add a hint to the warning message, simplify name computation]
Reviewed-by: Nir Soffer <nsoffer@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
qemu-img.c | 29 +++++++++++++++++--
tests/qemu-iotests/tests/qemu-img-bitmaps | 3 +-
tests/qemu-iotests/tests/qemu-img-bitmaps.out | 21 ++------------
3 files changed, 30 insertions(+), 23 deletions(-)
diff --git a/qemu-img.c b/qemu-img.c
index 797742a44331..c5496e82e025 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -2101,6 +2101,29 @@ static int convert_do_copy(ImgConvertState *s)
return s->ret;
}
+/* Check that bitmaps can be copied, or output an error */
+static int convert_check_bitmaps(BlockDriverState *src)
+{
+ BdrvDirtyBitmap *bm;
+
+ if (!bdrv_supports_persistent_dirty_bitmap(src)) {
+ error_report("Source lacks bitmap support");
+ return -1;
+ }
+ FOR_EACH_DIRTY_BITMAP(src, bm) {
+ if (!bdrv_dirty_bitmap_get_persistence(bm)) {
+ continue;
+ }
+ if (bdrv_dirty_bitmap_inconsistent(bm)) {
+ error_report("Cannot copy inconsistent bitmap '%s'",
+ bdrv_dirty_bitmap_name(bm));
+ error_printf("Try 'qemu-img bitmap --remove' to delete it\n");
+ return -1;
+ }
+ }
+ return 0;
+}
+
static int convert_copy_bitmaps(BlockDriverState *src, BlockDriverState *dst)
{
BdrvDirtyBitmap *bm;
@@ -2127,6 +2150,7 @@ static int convert_copy_bitmaps(BlockDriverState *src, BlockDriverState *dst)
&err);
if (err) {
error_reportf_err(err, "Failed to populate bitmap %s: ", name);
+ qmp_block_dirty_bitmap_remove(dst->node_name, name, NULL);
return -1;
}
}
@@ -2554,9 +2578,8 @@ static int img_convert(int argc, char **argv)
ret = -1;
goto out;
}
- if (!bdrv_supports_persistent_dirty_bitmap(blk_bs(s.src[0]))) {
- error_report("Source lacks bitmap support");
- ret = -1;
+ ret = convert_check_bitmaps(blk_bs(s.src[0]));
+ if (ret < 0) {
goto out;
}
}
diff --git a/tests/qemu-iotests/tests/qemu-img-bitmaps b/tests/qemu-iotests/tests/qemu-img-bitmaps
index 409c4497a303..09c3d395d1eb 100755
--- a/tests/qemu-iotests/tests/qemu-img-bitmaps
+++ b/tests/qemu-iotests/tests/qemu-img-bitmaps
@@ -140,11 +140,10 @@ $QEMU_IO -c abort "$TEST_IMG" 2>/dev/null
$QEMU_IMG bitmap --add "$TEST_IMG" b4
$QEMU_IMG bitmap --remove "$TEST_IMG" b1
_img_info --format-specific | _filter_irrelevant_img_info
+# Proof that we fail fast if bitmaps can't be copied
echo
$QEMU_IMG convert --bitmaps -O qcow2 "$TEST_IMG" "$TEST_IMG.copy" &&
echo "unexpected success"
-# Bug - even though we failed at conversion, we left a file around with
-# a bitmap marked as not corrupt
TEST_IMG=$TEST_IMG.copy _img_info --format-specific \
| _filter_irrelevant_img_info
diff --git a/tests/qemu-iotests/tests/qemu-img-bitmaps.out b/tests/qemu-iotests/tests/qemu-img-bitmaps.out
index 6824d4112893..d99c279d0c63 100644
--- a/tests/qemu-iotests/tests/qemu-img-bitmaps.out
+++ b/tests/qemu-iotests/tests/qemu-img-bitmaps.out
@@ -144,22 +144,7 @@ Format specific information:
granularity: 65536
corrupt: false
-qemu-img: Failed to populate bitmap b0: Bitmap 'b0' is inconsistent and cannot be used
-Try block-dirty-bitmap-remove to delete this bitmap from disk
-image: TEST_DIR/t.IMGFMT.copy
-file format: IMGFMT
-virtual size: 10 MiB (10485760 bytes)
-cluster_size: 65536
-Format specific information:
- bitmaps:
- [0]:
- flags:
- name: b0
- granularity: 65536
- [1]:
- flags:
- [0]: auto
- name: b4
- granularity: 65536
- corrupt: false
+qemu-img: Cannot copy inconsistent bitmap 'b0'
+Try 'qemu-img bitmap --remove' to delete it
+qemu-img: Could not open 'TEST_DIR/t.IMGFMT.copy': Could not open 'TEST_DIR/t.IMGFMT.copy': No such file or directory
*** done
--
2.31.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PULL 3/3] qemu-img: Add --skip-broken-bitmaps for 'convert --bitmaps'
2021-07-21 19:47 [PULL 0/3] block bitmaps patches for rc1, 2021-07-21 Eric Blake
2021-07-21 19:47 ` [PULL 1/3] iotests: Improve and rename test 291 to qemu-img-bitmap Eric Blake
2021-07-21 19:47 ` [PULL 2/3] qemu-img: Fail fast on convert --bitmaps with inconsistent bitmap Eric Blake
@ 2021-07-21 19:47 ` Eric Blake
2021-07-22 13:00 ` [PULL 0/3] block bitmaps patches for rc1, 2021-07-21 Peter Maydell
3 siblings, 0 replies; 5+ messages in thread
From: Eric Blake @ 2021-07-21 19:47 UTC (permalink / raw)
To: qemu-devel
Cc: Kevin Wolf, Vladimir Sementsov-Ogievskiy,
open list:Block layer core, Max Reitz
The point of 'qemu-img convert --bitmaps' is to be a convenience for
actions that are already possible through a string of smaller
'qemu-img bitmap' sub-commands. One situation not accounted for
already is that if a source image contains an inconsistent bitmap (for
example, because a qemu process died abruptly before flushing bitmap
state), the user MUST delete those inconsistent bitmaps before
anything else useful can be done with the image.
We don't want to delete inconsistent bitmaps by default: although a
corrupt bitmap is only a loss of optimization rather than a corruption
of user-visible data, it is still nice to require the user to opt in
to the fact that they are aware of the loss of the bitmap. Still,
requiring the user to check 'qemu-img info' to see whether bitmaps are
consistent, then use 'qemu-img bitmap --remove' to remove offenders,
all before using 'qemu-img convert', is a lot more work than just
adding a knob 'qemu-img convert --bitmaps --skip-broken-bitmaps' which
opts in to skipping the broken bitmaps.
After testing the new option, also demonstrate the way to manually fix
things (either deleting bad bitmaps, or re-creating them as empty) so
that it is possible to convert without the option.
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1946084
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20210709153951.2801666-4-eblake@redhat.com>
[eblake: warning message tweak, test enhancements]
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
docs/tools/qemu-img.rst | 8 ++++-
qemu-img.c | 29 +++++++++++----
tests/qemu-iotests/tests/qemu-img-bitmaps | 16 ++++++++-
tests/qemu-iotests/tests/qemu-img-bitmaps.out | 35 ++++++++++++++++++-
4 files changed, 79 insertions(+), 9 deletions(-)
diff --git a/docs/tools/qemu-img.rst b/docs/tools/qemu-img.rst
index 1d8470eada0e..b7d602a28804 100644
--- a/docs/tools/qemu-img.rst
+++ b/docs/tools/qemu-img.rst
@@ -414,7 +414,7 @@ Command description:
4
Error on reading data
-.. option:: convert [--object OBJECTDEF] [--image-opts] [--target-image-opts] [--target-is-zero] [--bitmaps] [-U] [-C] [-c] [-p] [-q] [-n] [-f FMT] [-t CACHE] [-T SRC_CACHE] [-O OUTPUT_FMT] [-B BACKING_FILE] [-o OPTIONS] [-l SNAPSHOT_PARAM] [-S SPARSE_SIZE] [-r RATE_LIMIT] [-m NUM_COROUTINES] [-W] FILENAME [FILENAME2 [...]] OUTPUT_FILENAME
+.. option:: convert [--object OBJECTDEF] [--image-opts] [--target-image-opts] [--target-is-zero] [--bitmaps [--skip-broken-bitmaps]] [-U] [-C] [-c] [-p] [-q] [-n] [-f FMT] [-t CACHE] [-T SRC_CACHE] [-O OUTPUT_FMT] [-B BACKING_FILE] [-o OPTIONS] [-l SNAPSHOT_PARAM] [-S SPARSE_SIZE] [-r RATE_LIMIT] [-m NUM_COROUTINES] [-W] FILENAME [FILENAME2 [...]] OUTPUT_FILENAME
Convert the disk image *FILENAME* or a snapshot *SNAPSHOT_PARAM*
to disk image *OUTPUT_FILENAME* using format *OUTPUT_FMT*. It can
@@ -456,6 +456,12 @@ Command description:
*NUM_COROUTINES* specifies how many coroutines work in parallel during
the convert process (defaults to 8).
+ Use of ``--bitmaps`` requests that any persistent bitmaps present in
+ the original are also copied to the destination. If any bitmap is
+ inconsistent in the source, the conversion will fail unless
+ ``--skip-broken-bitmaps`` is also specified to copy only the
+ consistent bitmaps.
+
.. option:: create [--object OBJECTDEF] [-q] [-f FMT] [-b BACKING_FILE] [-F BACKING_FMT] [-u] [-o OPTIONS] FILENAME [SIZE]
Create the new disk image *FILENAME* of size *SIZE* and format
diff --git a/qemu-img.c b/qemu-img.c
index c5496e82e025..908fd0cce5b4 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -82,6 +82,7 @@ enum {
OPTION_MERGE = 274,
OPTION_BITMAPS = 275,
OPTION_FORCE = 276,
+ OPTION_SKIP_BROKEN = 277,
};
typedef enum OutputFormat {
@@ -2102,7 +2103,7 @@ static int convert_do_copy(ImgConvertState *s)
}
/* Check that bitmaps can be copied, or output an error */
-static int convert_check_bitmaps(BlockDriverState *src)
+static int convert_check_bitmaps(BlockDriverState *src, bool skip_broken)
{
BdrvDirtyBitmap *bm;
@@ -2114,17 +2115,19 @@ static int convert_check_bitmaps(BlockDriverState *src)
if (!bdrv_dirty_bitmap_get_persistence(bm)) {
continue;
}
- if (bdrv_dirty_bitmap_inconsistent(bm)) {
+ if (!skip_broken && bdrv_dirty_bitmap_inconsistent(bm)) {
error_report("Cannot copy inconsistent bitmap '%s'",
bdrv_dirty_bitmap_name(bm));
- error_printf("Try 'qemu-img bitmap --remove' to delete it\n");
+ error_printf("Try --skip-broken-bitmaps, or "
+ "use 'qemu-img bitmap --remove' to delete it\n");
return -1;
}
}
return 0;
}
-static int convert_copy_bitmaps(BlockDriverState *src, BlockDriverState *dst)
+static int convert_copy_bitmaps(BlockDriverState *src, BlockDriverState *dst,
+ bool skip_broken)
{
BdrvDirtyBitmap *bm;
Error *err = NULL;
@@ -2136,6 +2139,10 @@ static int convert_copy_bitmaps(BlockDriverState *src, BlockDriverState *dst)
continue;
}
name = bdrv_dirty_bitmap_name(bm);
+ if (skip_broken && bdrv_dirty_bitmap_inconsistent(bm)) {
+ warn_report("Skipping inconsistent bitmap '%s'", name);
+ continue;
+ }
qmp_block_dirty_bitmap_add(dst->node_name, name,
true, bdrv_dirty_bitmap_granularity(bm),
true, true,
@@ -2191,6 +2198,7 @@ static int img_convert(int argc, char **argv)
bool force_share = false;
bool explict_min_sparse = false;
bool bitmaps = false;
+ bool skip_broken = false;
int64_t rate_limit = 0;
ImgConvertState s = (ImgConvertState) {
@@ -2212,6 +2220,7 @@ static int img_convert(int argc, char **argv)
{"salvage", no_argument, 0, OPTION_SALVAGE},
{"target-is-zero", no_argument, 0, OPTION_TARGET_IS_ZERO},
{"bitmaps", no_argument, 0, OPTION_BITMAPS},
+ {"skip-broken-bitmaps", no_argument, 0, OPTION_SKIP_BROKEN},
{0, 0, 0, 0}
};
c = getopt_long(argc, argv, ":hf:O:B:Cco:l:S:pt:T:qnm:WUr:",
@@ -2340,6 +2349,9 @@ static int img_convert(int argc, char **argv)
case OPTION_BITMAPS:
bitmaps = true;
break;
+ case OPTION_SKIP_BROKEN:
+ skip_broken = true;
+ break;
}
}
@@ -2347,6 +2359,11 @@ static int img_convert(int argc, char **argv)
out_fmt = "raw";
}
+ if (skip_broken && !bitmaps) {
+ error_report("Use of --skip-broken-bitmaps requires --bitmaps");
+ goto fail_getopt;
+ }
+
if (s.compressed && s.copy_range) {
error_report("Cannot enable copy offloading when -c is used");
goto fail_getopt;
@@ -2578,7 +2595,7 @@ static int img_convert(int argc, char **argv)
ret = -1;
goto out;
}
- ret = convert_check_bitmaps(blk_bs(s.src[0]));
+ ret = convert_check_bitmaps(blk_bs(s.src[0]), skip_broken);
if (ret < 0) {
goto out;
}
@@ -2703,7 +2720,7 @@ static int img_convert(int argc, char **argv)
/* Now copy the bitmaps */
if (bitmaps && ret == 0) {
- ret = convert_copy_bitmaps(blk_bs(s.src[0]), out_bs);
+ ret = convert_copy_bitmaps(blk_bs(s.src[0]), out_bs, skip_broken);
}
out:
diff --git a/tests/qemu-iotests/tests/qemu-img-bitmaps b/tests/qemu-iotests/tests/qemu-img-bitmaps
index 09c3d395d1eb..7a3fe8c3d37a 100755
--- a/tests/qemu-iotests/tests/qemu-img-bitmaps
+++ b/tests/qemu-iotests/tests/qemu-img-bitmaps
@@ -144,7 +144,21 @@ _img_info --format-specific | _filter_irrelevant_img_info
echo
$QEMU_IMG convert --bitmaps -O qcow2 "$TEST_IMG" "$TEST_IMG.copy" &&
echo "unexpected success"
-TEST_IMG=$TEST_IMG.copy _img_info --format-specific \
+TEST_IMG="$TEST_IMG.copy" _img_info --format-specific \
+ | _filter_irrelevant_img_info
+# Skipping the broken bitmaps works,...
+echo
+$QEMU_IMG convert --bitmaps --skip-broken-bitmaps \
+ -O qcow2 "$TEST_IMG" "$TEST_IMG.copy"
+TEST_IMG="$TEST_IMG.copy" _img_info --format-specific \
+ | _filter_irrelevant_img_info
+# ...as does removing them
+echo
+_rm_test_img "$TEST_IMG.copy"
+$QEMU_IMG bitmap --remove "$TEST_IMG" b0
+$QEMU_IMG bitmap --remove --add "$TEST_IMG" b2
+$QEMU_IMG convert --bitmaps -O qcow2 "$TEST_IMG" "$TEST_IMG.copy"
+TEST_IMG="$TEST_IMG.copy" _img_info --format-specific \
| _filter_irrelevant_img_info
# success, all done
diff --git a/tests/qemu-iotests/tests/qemu-img-bitmaps.out b/tests/qemu-iotests/tests/qemu-img-bitmaps.out
index d99c279d0c63..e851f0320ecb 100644
--- a/tests/qemu-iotests/tests/qemu-img-bitmaps.out
+++ b/tests/qemu-iotests/tests/qemu-img-bitmaps.out
@@ -145,6 +145,39 @@ Format specific information:
corrupt: false
qemu-img: Cannot copy inconsistent bitmap 'b0'
-Try 'qemu-img bitmap --remove' to delete it
+Try --skip-broken-bitmaps, or use 'qemu-img bitmap --remove' to delete it
qemu-img: Could not open 'TEST_DIR/t.IMGFMT.copy': Could not open 'TEST_DIR/t.IMGFMT.copy': No such file or directory
+
+qemu-img: warning: Skipping inconsistent bitmap 'b0'
+qemu-img: warning: Skipping inconsistent bitmap 'b2'
+image: TEST_DIR/t.IMGFMT.copy
+file format: IMGFMT
+virtual size: 10 MiB (10485760 bytes)
+cluster_size: 65536
+Format specific information:
+ bitmaps:
+ [0]:
+ flags:
+ [0]: auto
+ name: b4
+ granularity: 65536
+ corrupt: false
+
+image: TEST_DIR/t.IMGFMT.copy
+file format: IMGFMT
+virtual size: 10 MiB (10485760 bytes)
+cluster_size: 65536
+Format specific information:
+ bitmaps:
+ [0]:
+ flags:
+ [0]: auto
+ name: b4
+ granularity: 65536
+ [1]:
+ flags:
+ [0]: auto
+ name: b2
+ granularity: 65536
+ corrupt: false
*** done
--
2.31.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PULL 0/3] block bitmaps patches for rc1, 2021-07-21
2021-07-21 19:47 [PULL 0/3] block bitmaps patches for rc1, 2021-07-21 Eric Blake
` (2 preceding siblings ...)
2021-07-21 19:47 ` [PULL 3/3] qemu-img: Add --skip-broken-bitmaps for 'convert --bitmaps' Eric Blake
@ 2021-07-22 13:00 ` Peter Maydell
3 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2021-07-22 13:00 UTC (permalink / raw)
To: Eric Blake; +Cc: QEMU Developers
On Wed, 21 Jul 2021 at 20:49, Eric Blake <eblake@redhat.com> wrote:
>
> The following changes since commit e77c8b8b8e933414ef07dbed04e02973fccffeb0:
>
> Update version for v6.1.0-rc0 release (2021-07-21 17:10:15 +0100)
>
> are available in the Git repository at:
>
> https://repo.or.cz/qemu/ericb.git tags/pull-bitmaps-2021-07-21
>
> for you to fetch changes up to 955171e4417bf39edb5503e694501e082a757731:
>
> qemu-img: Add --skip-broken-bitmaps for 'convert --bitmaps' (2021-07-21 14:14:41 -0500)
>
> ----------------------------------------------------------------
> block bitmaps patches for 2021-07-21
>
> - fix 'qemu-img convert --bitmaps' handling of qcow2 files with
> inconsistent bitmaps
>
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/6.1
for any user-visible changes.
-- PMM
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-07-22 13:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-07-21 19:47 [PULL 0/3] block bitmaps patches for rc1, 2021-07-21 Eric Blake
2021-07-21 19:47 ` [PULL 1/3] iotests: Improve and rename test 291 to qemu-img-bitmap Eric Blake
2021-07-21 19:47 ` [PULL 2/3] qemu-img: Fail fast on convert --bitmaps with inconsistent bitmap Eric Blake
2021-07-21 19:47 ` [PULL 3/3] qemu-img: Add --skip-broken-bitmaps for 'convert --bitmaps' Eric Blake
2021-07-22 13:00 ` [PULL 0/3] block bitmaps patches for rc1, 2021-07-21 Peter Maydell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).