From: Eric Blake <eblake@redhat.com>
To: Nir Soffer <nsoffer@redhat.com>
Cc: QEMU Developers <qemu-devel@nongnu.org>,
Kevin Wolf <kwolf@redhat.com>, qemu-block <qemu-block@nongnu.org>,
Nir Soffer <nirsof@gmail.com>, Max Reitz <mreitz@redhat.com>
Subject: Re: [PATCH 2/2] qemu-iotests: Test convert to qcow2 compressed to NBD
Date: Mon, 27 Jul 2020 09:41:49 -0500 [thread overview]
Message-ID: <5e87add3-57ed-1c57-4ea3-07a77cda3882@redhat.com> (raw)
In-Reply-To: <CAMRbyytButqSyqAXVFgMzMKoaRUYfCYWAUAoFQs9TXS0PSrX0Q@mail.gmail.com>
On 7/27/20 9:35 AM, Nir Soffer wrote:
>> I guess it's okay that you don't create a real tar file here, but
>> listing the commands to create it (even as a comment) is better than
>> just saying "trust me". And it doesn't seem like that much more work -
>> it looks like the key to your test is that you created a tar file
>> containing two files, where the first file was less than 512 bytes and
>> the second file is your target destination that you will be rewriting.
>
> The real code is more complicated, something like:
>
> offset = tar.fileobj.tell() + BLOCK_SIZE
>
> with open(tar.name, "r+") as f:
> f.truncate(offset + measure["required"])
>
> convert_image(image, tar.name, offset)
>
> check = check_image(tar.name, offset)
> size = check["image-end-offset"]
>
> member = tarfile.TarInfo(name)
> member.size = size
> tar.addfile(member)
>
> tar_size = offset + round_up(size)
>
> tar.fileobj.seek(tar_size)
> with open(tar.name, "r+") as f:
> f.truncate(tar_size)
>
> I'm not sure it helps qemu developers working on these tests.
The closer the iotest is to reality, the more likely it will serve as a
good regression test. Cutting corners risks a test that passes in
isolation even when we've done something that breaks the overall process
in one of the corners you cut.
>>
>> At any rate, given the urgency of getting pull requests for -rc2 in
>> before slamming Peter tomorrow, I'll probably try to touch up the issues
>> Max pointed out and queue it today.
>
> Thanks Max and Eric.
>
> Should I post a fixed version later today?
A v2 would be helpful.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
next prev parent reply other threads:[~2020-07-27 14:42 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-26 15:25 [PATCH 0/2] Fix convert to qcow2 compressed to NBD Nir Soffer
2020-07-26 15:25 ` [PATCH 1/2] block: nbd: Fix convert qcow2 compressed to nbd Nir Soffer
2020-07-27 8:58 ` Max Reitz
2020-07-27 14:04 ` Eric Blake
2020-07-27 14:52 ` Nir Soffer
2020-07-27 15:12 ` Nir Soffer
2020-07-26 15:25 ` [PATCH 2/2] qemu-iotests: Test convert to qcow2 compressed to NBD Nir Soffer
2020-07-27 10:04 ` Max Reitz
2020-07-27 14:14 ` Eric Blake
2020-07-27 14:35 ` Nir Soffer
2020-07-27 14:41 ` Eric Blake [this message]
2020-07-27 14:44 ` Nir Soffer
2020-07-27 14:44 ` Nir Soffer
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=5e87add3-57ed-1c57-4ea3-07a77cda3882@redhat.com \
--to=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=nirsof@gmail.com \
--cc=nsoffer@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/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).