[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 6/6] iotests: Add test 291 to for qemu-img bitmap coverage
From: |
Max Reitz |
Subject: |
Re: [PATCH v2 6/6] iotests: Add test 291 to for qemu-img bitmap coverage |
Date: |
Mon, 4 May 2020 15:05:25 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 |
On 21.04.20 23:20, Eric Blake wrote:
> Add a new test covering the 'qemu-img bitmap' subcommand, as well as
> 'qemu-img convert --bitmaps', both added in recent patches.
>
> Signed-off-by: Eric Blake <address@hidden>
> ---
> tests/qemu-iotests/291 | 103 +++++++++++++++++++++++++++++++++++++
> tests/qemu-iotests/291.out | 78 ++++++++++++++++++++++++++++
> tests/qemu-iotests/group | 1 +
> 3 files changed, 182 insertions(+)
> create mode 100755 tests/qemu-iotests/291
> create mode 100644 tests/qemu-iotests/291.out
>
> diff --git a/tests/qemu-iotests/291 b/tests/qemu-iotests/291
> new file mode 100755
> index 000000000000..77713c0cfea7
> --- /dev/null
> +++ b/tests/qemu-iotests/291
[...]
> +echo
> +echo "=== Bitmap preservation not possible to non-qcow2 ==="
> +echo
> +
> +mv "$TEST_IMG" "$TEST_IMG.orig"
“mv” doesn’t work images with external data files.
(ORIG_IMG=$TEST_IMG; TEST_IMG="$TEST_IMG".orig should work)
> +$QEMU_IMG convert --bitmaps -O raw "$TEST_IMG.orig" "$TEST_IMG"
> +
> +echo
> +echo "=== Convert with bitmap preservation ==="
> +echo
> +
> +# Only bitmaps from the active layer are copied
That’s kind of obvious when you think about (whenever an image is
attached to a VM, only the active layer’s bitmaps are visible, not those
from the backing chain), but maybe this should be noted in the
documentation?
> +$QEMU_IMG convert --bitmaps -O qcow2 "$TEST_IMG.orig" "$TEST_IMG"
> +$QEMU_IMG info "$TEST_IMG" | _filter_img_info --format-specific
> +# But we can also merge in bitmaps from other layers
> +$QEMU_IMG bitmap --add --disabled -f $IMGFMT "$TEST_IMG" b0
> +$QEMU_IMG bitmap --add -f $IMGFMT "$TEST_IMG" tmp
> +$QEMU_IMG bitmap --merge b0 -b "$TEST_IMG.base" -F $IMGFMT "$TEST_IMG" tmp
> +$QEMU_IMG bitmap --merge tmp "$TEST_IMG" b0
> +$QEMU_IMG bitmap --remove -f $IMGFMT "$TEST_IMG" tmp
Why do we need tmp here? Can’t we just merge base’s b0 directly into
$TEST_IMG’s b0?
[...]
> diff --git a/tests/qemu-iotests/291.out b/tests/qemu-iotests/291.out
> new file mode 100644
> index 000000000000..d716c0c7cc0b
> --- /dev/null
> +++ b/tests/qemu-iotests/291.out
[...]
> +=== Check bitmap contents ===
> +
> +[{ "start": 0, "length": 3145728, "depth": 0, "zero": false, "data": true,
> "offset": OFFSET},
> +{ "start": 3145728, "length": 1048576, "depth": 0, "zero": false, "data":
> false},
> +{ "start": 4194304, "length": 6291456, "depth": 0, "zero": false, "data":
> true, "offset": OFFSET}]
> +[{ "start": 0, "length": 1048576, "depth": 0, "zero": false, "data": true,
> "offset": OFFSET},
> +{ "start": 1048576, "length": 1048576, "depth": 0, "zero": false, "data":
> false},
> +{ "start": 2097152, "length": 8388608, "depth": 0, "zero": false, "data":
> true, "offset": OFFSET}]
> +[{ "start": 0, "length": 2097152, "depth": 0, "zero": false, "data": true,
> "offset": OFFSET},
> +{ "start": 2097152, "length": 1048576, "depth": 0, "zero": false, "data":
> false},
> +{ "start": 3145728, "length": 7340032, "depth": 0, "zero": false, "data":
> true, "offset": OFFSET}]
Am I looking at this wrong or does the bitmap data seem to be inverted?
Everywhere where I’d expect the bitmaps to be cleared, this map reports
data=true, whereas where I’d expect them to be set, it reports data=false.
I suppose that’s intentional, but can you explain this behavior to me?
Max
> +*** done
signature.asc
Description: OpenPGP digital signature
- Re: [PATCH v2 6/6] iotests: Add test 291 to for qemu-img bitmap coverage,
Max Reitz <=