On 05/30/2018 07:35 AM, Nir Soffer wrote:
This is not the flow we are looking for. We need a way to read qcow2
from a pipe.
Why? The qcow2 format inherently requires seeking (or a HUGE amount of
free RAM) the moment you want to interpret the data as qcow2. It can't
be piped when being produced or consumed for reading guest contents (it
can be piped as a read-only format if you aren't inspecting guest
contents, but then again so can raw).
If you are asking how to connect a SEEKABLE network connection, so that
you don't need temporary storage locally, then NBD is a great format (it
is network friendly, where the local qemu-img process is using the
remote server for all storage; no local storage required). But even
then, it still requires a seekable input if you are not visiting the
file in byte order, and qcow2 as an interpreted format cannot be written
or read in byte order (for example, it inherently requires dereferencing
through header, L1, L2, and refcount tables, which implies seeking).
> But in any case you can just use the nbdkit tar plugin which
> does all of this.
Can it work with a tar stream read from stdin, or it requires a tar file?
nbdkit includes a plugin for creating a seekable layer on top of a pipe,
at the expense of a huge memory cost (you have to have as much RAM
available as you would ever have to seek backwards). It also makes it
easy to have a plugin for a tar file (reading tar files is easy; writing
is a bit harder, but should work as long as you don't need resize and
don't have any compressed sparse regions that need to be rewritten to
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266