qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: Eric Blake <eblake@redhat.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Peter Lieven <pl@kamp.de>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 21/21] iotests: Add test for different refcount widths
Date: Wed, 12 Nov 2014 09:58:58 +0100	[thread overview]
Message-ID: <54632152.70900@redhat.com> (raw)
In-Reply-To: <54626952.30006@redhat.com>

On 2014-11-11 at 20:53, Eric Blake wrote:
> On 11/10/2014 06:45 AM, Max Reitz wrote:
>> Add a test for conversion between different refcount widths and errors
>> specific to certain widths (i.e. snapshots with refcount_width=1).
>>
>> Signed-off-by: Max Reitz <mreitz@redhat.com>
>> ---
>>   tests/qemu-iotests/112     | 225 +++++++++++++++++++++++++++++++++++++++++++++
>>   tests/qemu-iotests/112.out | 123 +++++++++++++++++++++++++
>>   tests/qemu-iotests/group   |   1 +
>>   3 files changed, 349 insertions(+)
>>   create mode 100755 tests/qemu-iotests/112
>>   create mode 100644 tests/qemu-iotests/112.out
>>
>> +
>> +# This tests qocw2-specific low-level functionality
>> +_supported_fmt qcow2
>> +_supported_proto file
>> +_supported_os Linux
> Might work on more than just Linux, but then again, it's probably worth
> scrubbing the whole testsuite for situations like that, so don't worry
> about it here.
>
>> +# This test will set refcount_width on its own which would conflict with the
>> +# manual setting; compat will be overridden as well
>> +_unsupported_imgopts refcount_width 'compat=0.10'
>> +
>> +function print_refcount_width()
>> +{
>> +    $QEMU_IMG info "$TEST_IMG" | grep 'refcount width:' | sed -e 's/^ *//'
> grep|sed is almost always a waste.  This is equivalent:
>
>     $QEMU_IMG info "$TEST_IMG" | sed -n '/refcount width:/ s/^ *//p'

As said before, I just don't know sed well enough. My knowledge of sed 
is "you can use it for regex replacement with -e", and that's about it. 
Oh, and "you can do it in-place with -i" and "someone wrote Sokoban in 
sed". And maybe even "sed better fits the term Standard EDitor than ed 
does".

But thanks a lot for telling me, I'm just always afraid to learn sed 
because it seems even more unreadable than perl to me...

>> +echo
>> +echo '=== Snapshot limit on refcount_width=1 ==='
>> +echo
>> +
>> +IMGOPTS="$IMGOPTS,refcount_width=1" _make_test_img 64M
>> +print_refcount_width
>> +
>> +$QEMU_IO -c 'write 0 512' "$TEST_IMG" | _filter_qemu_io
>> +
>> +# Should fail
>> +$QEMU_IMG snapshot -c foo "$TEST_IMG"
>> +
>> +# The new L1 table could/shoud be leaked
> s/shoud/should/

Right.

>> +_check_test_img
>> +
>> +echo
>> +echo '=== Snapshot limit on refcount_width=2 ==='
>> +echo
>> +
>> +IMGOPTS="$IMGOPTS,refcount_width=2" _make_test_img 64M
>> +print_refcount_width
>> +
>> +$QEMU_IO -c 'write 0 512' "$TEST_IMG" | _filter_qemu_io
>> +
>> +# Should succeed
>> +$QEMU_IMG snapshot -c foo "$TEST_IMG"
>> +$QEMU_IMG snapshot -c bar "$TEST_IMG"
>> +# Should fail (4th reference)
>> +$QEMU_IMG snapshot -c baz "$TEST_IMG"
>> +
>> +# The new L1 table could/shoud be leaked
> again

yyp is dangerous.

>> +echo
>> +echo '=== Amend with snapshot ==='
>> +echo
>> +
>> +$QEMU_IMG snapshot -c foo "$TEST_IMG"
>> +# Just to have different refcounts across the image
>> +$QEMU_IO -c 'write 0 16M' "$TEST_IMG" | _filter_qemu_io
>> +
>> +# Should not work
>> +$QEMU_IMG amend -o refcount_width=1 "$TEST_IMG"
>> +_check_test_img
>> +print_refcount_width
> This matches your initial implementation. Someday, though, we may decide
> to auto-COW any overflowed cluster, and thus allow the conversion to
> succeed.  Worth a comment?

Yes, will do.

>> +echo '=== Testing too many references for check ==='
>> +echo
>> +
>> +IMGOPTS="$IMGOPTS,refcount_width=1" _make_test_img 64M
>> +print_refcount_width
>> +
>> +# This cluster should be created at 0x50000
>> +$QEMU_IO -c 'write 0 64k' "$TEST_IMG" | _filter_qemu_io
>> +# Now make the second L2 entriy (the L2 table should be at 0x40000) point to
> s/entriy/entry/

I think this happened because at one point in time it said something 
about "L2 entries".

>> +# success, all done
>> +echo '*** done'
>> +rm -f $seq.full
>> +status=0
> Overall a nice set of tests!
>
>
>> +=== Snapshot limit on refcount_width=1 ===
>> +
>> +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
>> +refcount width: 1
>> +wrote 512/512 bytes at offset 0
>> +512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
>> +qemu-img: Could not create snapshot 'foo': -22 (Invalid argument)
>> +Leaked cluster 6 refcount=1 reference=0
> Bummer that the error message did not state WHY (because a cluster would
> overflow refcounts), but I'm not sure how hard it would be to make that
> better, and at least we correctly errored out.

Yes, I know, it's a really bad error. The problem is that no Error 
object is used in that path at all so it will be rather cumbersome, but 
I'll look into it one more time.

Max

      reply	other threads:[~2014-11-12  8:59 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-10 13:45 [Qemu-devel] [PATCH 00/21] qcow2: Support refcount orders != 4 Max Reitz
2014-11-10 13:45 ` [Qemu-devel] [PATCH 01/21] qcow2: Add two new fields to BDRVQcowState Max Reitz
2014-11-10 19:00   ` Eric Blake
2014-11-10 13:45 ` [Qemu-devel] [PATCH 02/21] qcow2: Add refcount_width to format-specific info Max Reitz
2014-11-10 19:06   ` Eric Blake
2014-11-11  8:11     ` Max Reitz
2014-11-11 15:49       ` Eric Blake
2014-11-10 13:45 ` [Qemu-devel] [PATCH 03/21] qcow2: Use 64 bits for refcount values Max Reitz
2014-11-10 20:59   ` Eric Blake
2014-11-11  8:12     ` Max Reitz
2014-11-11  9:22     ` Kevin Wolf
2014-11-11  9:25       ` Max Reitz
2014-11-11  9:26         ` Max Reitz
2014-11-11  9:36         ` Kevin Wolf
2014-11-10 13:45 ` [Qemu-devel] [PATCH 04/21] qcow2: Respect error in qcow2_alloc_bytes() Max Reitz
2014-11-10 21:05   ` Eric Blake
2014-11-10 13:45 ` [Qemu-devel] [PATCH 05/21] qcow2: Refcount overflow and qcow2_alloc_bytes() Max Reitz
2014-11-10 21:12   ` Eric Blake
2014-11-11  8:22     ` Max Reitz
2014-11-11 16:13       ` Eric Blake
2014-11-11 16:18         ` Max Reitz
2014-11-11 19:49           ` Eric Blake
2014-11-12  8:52             ` Max Reitz
2014-11-10 13:45 ` [Qemu-devel] [PATCH 06/21] qcow2: Helper function for refcount modification Max Reitz
2014-11-10 22:30   ` Eric Blake
2014-11-11  8:35     ` Max Reitz
2014-11-11  9:43       ` Max Reitz
2014-11-11 10:56       ` Max Reitz
2014-11-10 13:45 ` [Qemu-devel] [PATCH 07/21] qcow2: Helper for refcount array size calculation Max Reitz
2014-11-10 22:49   ` Eric Blake
2014-11-11  8:37     ` Max Reitz
2014-11-11 10:08       ` Max Reitz
2014-11-10 13:45 ` [Qemu-devel] [PATCH 08/21] qcow2: More helpers for refcount modification Max Reitz
2014-11-11  0:29   ` Eric Blake
2014-11-11  8:42     ` Max Reitz
2014-11-10 13:45 ` [Qemu-devel] [PATCH 09/21] qcow2: Open images with refcount order != 4 Max Reitz
2014-11-10 17:03   ` Eric Blake
2014-11-10 17:06     ` Max Reitz
2014-11-10 13:45 ` [Qemu-devel] [PATCH 10/21] qcow2: refcount_order parameter for qcow2_create2 Max Reitz
2014-11-11  5:40   ` Eric Blake
2014-11-11  8:48     ` Max Reitz
2014-11-10 13:45 ` [Qemu-devel] [PATCH 11/21] iotests: Prepare for refcount_width option Max Reitz
2014-11-11 17:57   ` Eric Blake
2014-11-12  8:41     ` Max Reitz
2014-11-10 13:45 ` [Qemu-devel] [PATCH 12/21] qcow2: Allow creation with refcount order != 4 Max Reitz
2014-11-11 18:05   ` Eric Blake
2014-11-12  8:47     ` Max Reitz
2014-11-10 13:45 ` [Qemu-devel] [PATCH 13/21] block: Add opaque value to the amend CB Max Reitz
2014-11-11 18:08   ` Eric Blake
2014-11-10 13:45 ` [Qemu-devel] [PATCH 14/21] qcow2: Use error_report() in qcow2_amend_options() Max Reitz
2014-11-11 18:11   ` Eric Blake
2014-11-12  8:47     ` Max Reitz
2014-11-10 13:45 ` [Qemu-devel] [PATCH 15/21] qcow2: Use abort() instead of assert(false) Max Reitz
2014-11-11 18:12   ` Eric Blake
2014-11-12  8:48     ` Max Reitz
2014-11-10 13:45 ` [Qemu-devel] [PATCH 16/21] qcow2: Split upgrade/downgrade paths for amend Max Reitz
2014-11-11 18:14   ` Eric Blake
2014-11-10 13:45 ` [Qemu-devel] [PATCH 17/21] qcow2: Use intermediate helper CB " Max Reitz
2014-11-11 21:05   ` Eric Blake
2014-11-12  9:10     ` Max Reitz
2014-11-10 13:45 ` [Qemu-devel] [PATCH 18/21] qcow2: Add function for refcount order amendment Max Reitz
2014-11-12  4:15   ` Eric Blake
2014-11-12  9:55     ` Max Reitz
2014-11-12 13:50       ` Eric Blake
2014-11-12 14:19   ` Eric Blake
2014-11-12 14:21     ` Max Reitz
2014-11-12 17:45       ` Max Reitz
2014-11-12 20:21         ` Eric Blake
2014-11-10 13:45 ` [Qemu-devel] [PATCH 19/21] qcow2: Invoke refcount order amendment function Max Reitz
2014-11-12  4:36   ` Eric Blake
2014-11-10 13:45 ` [Qemu-devel] [PATCH 20/21] qcow2: Point to amend function in check Max Reitz
2014-11-12  4:38   ` Eric Blake
2014-11-10 13:45 ` [Qemu-devel] [PATCH 21/21] iotests: Add test for different refcount widths Max Reitz
2014-11-11 19:53   ` Eric Blake
2014-11-12  8:58     ` Max Reitz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54632152.70900@redhat.com \
    --to=mreitz@redhat.com \
    --cc=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pl@kamp.de \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).