Am 30.05.2018 um 15:44 hat Eric Blake geschrieben:
On 05/29/2018 04:18 PM, Nir Soffer wrote:
> > You CAN get a logically collapsed view of storage (that is, what the
> > guest would see), by using an NBD export of volume V. Reading from that
> > volume will then pull sectors from whichever portion of the chain you
> > need. You can use either qemu-nbd (if no guest is writing to the
> > chain), or within a running qemu, you can use nbd-server-start and
> > nbd-server-add (over QMP) to get such an NBD server running.
> NBD expose the guest data, but we want the qcow2 stream - without
> creating a new image.
NBD can do both. You choose whether it exposes the guest data or the qcow2
data, by whether the client or the server is interpreting qcow2 data.
But if I understand correctly, it doesn't result in the image Nir wants.
You would only export an existing qcow2 file, i.e. a single layer in the
backing chain, this way. The question was about a collapsed image, i.e.
the disk content as the guest sees it.
The problem is that qcow2 just isn't made to be streamable. Importing a
qcow2 stream without saving it into a temporary file (or a memory buffer
as large as the image file) simply isn't possible in the general case.
Exporting to a stream is possible if we're allowed to make two passes
over the source, but the existing QEMU code is useless for that because
it inherently requires seeking. I think if I had to get something like
this, I'd probably implement such an exporter as a script external to