On 05/28/2018 05:27 AM, Arik Hadas wrote:
[Answering before reading the entire thread; apologies if I'm repeating
things, or if I have to chime in again at other spots]
Let me demonstrate briefly the flow for OVA:
Let's say that we have a VM that is based on a template and has one disk
and one snapshot, so its volume-chain would be:
T -> S -> V
(V is the volume the VM writes to, S is the backing file of V and T is the
backing file of S).
I tend to write backing relationships as a left arrow, as in:
T <- S <- V
(can be read as: S depends on T, and V depends on S)
When exporting that VM to an OVA file we want the produced tar file
(1) OVF configuration
(2) single disk volume (preferably qcow).
So we need to collapse T, S, V into a single volume.
Sure, we can do 'qemu-img convert'. That's what we do now in oVirt 4.2:
(a) qemu-img convert produces a 'temporary' collapsed volume
(b) make a tar file of the OVf configuration and that 'temporary' volume
(c) delete the temporary volume
But the fact that we produce that 'temporary' volume obviously slows down
the entire operation.
It would be much better if we could "open" a stream that we can read from
the 'collapsed' form of that chain and stream it directly into the
appropriate tar file entry, without extra writes to the storage device.
Few months ago people from the oVirt-storage team checked the qemu toolset
and replied that this capability is not yet provided, therefore we
implemented the workaround described above. Apparently, the desired ability
can also be useful for the flow discussed in this thread so it worth asking
for it again :)
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.
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266