qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/2] qemu-iotests: Test convert to qcow2 compressed to NBD


From: Eric Blake
Subject: Re: [PATCH 2/2] qemu-iotests: Test convert to qcow2 compressed to NBD
Date: Mon, 27 Jul 2020 09:41:49 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]