On Tue, Mar 10, 2020 at 8:59 PM Nir Soffer <nsof...@redhat.com> wrote:
>
> On Thu, Mar 5, 2020 at 12:49 PM Jakub Dżon <jd...@redhat.com> wrote:
> >
> > Hi,
> > I'm looking into how current state of a volume (as seen by the VM) can
> > be downloaded in raw format using imageio and I wonder what is the
> > behavior when I request a qcow2 volume. Will it always return the top
> > snapshot in qcow2 format?
>
> It depends on the format argument of the ImageTransfer.
>
> If you don't specify the format, we use the file backend and you get
> the top volume in the chain as is (qcow2 or raw).
>
> If you specify "raw" format we use the nbd backend, and in this case
> you get the entire disk in raw format, including all the snapshots.
>
> > I understand that in 4.4 I can explicitly specify
> > format=types.DiskFormat.RAW when creating the transfer to get the
> > current state of the disk converted to raw format.
>
> Exactly
>
> > Is that also possible in older versions and how?
>
> Support for format="raw" was added in 4.3, so it may work
> with 4.3. However in 4.3 imagio daemon did not support the extents
> API, so downloading entire image in raw format is not very practical.
> For example if you download 50g empty qcow2 image you will download
> 50g of zeroes.
>
> In 4.4. you can find if imageio daemon supports the extents API by doing
> OPTIONS request on the transfer_url and looking for the "extents" feature.
> If the extents feature is enabled, you can get the list of extents using
> a GET request on transfer_url + "/extents', and then you can download
> only the data extents and skip the zero extents.
>
> See the fosdem talk about incremental backup for more details:
> https://fosdem.org/2020/schedule/event/vai_back_to_the_future/
>
> Slides:
> https://docs.google.com/presentation/d/e/2PACX-1vTYZrJp4F4XIM_9eg-_dGJdM6aCr5ugkwc8Pvp6VGdPjefVGANDxA9kwMGatW5G1QufKrpY2eLGKdwC/pub?start=false&loop=false&delayms=3000

Another useful resource is the http backend in imageio daemon:
https://github.com/oVirt/ovirt-imageio/blob/master/daemon/ovirt_imageio/backends/http.py

How to handle OPTIONS with multiple daemon/proxy versions:
https://github.com/oVirt/ovirt-imageio/blob/efb1267ca377959bedb9e1c64da426436cd2a3ce/daemon/ovirt_imageio/backends/http.py#L345

How to handle extents, supporting both new and old daemon versions:
https://github.com/oVirt/ovirt-imageio/blob/efb1267ca377959bedb9e1c64da426436cd2a3ce/daemon/ovirt_imageio/backends/http.py#L192

Configuring the backend based on options:
https://github.com/oVirt/ovirt-imageio/blob/efb1267ca377959bedb9e1c64da426436cd2a3ce/daemon/ovirt_imageio/backends/http.py#L48

Optimizing connection using unix socket (relevant only if your code
runs on the same host):
https://github.com/oVirt/ovirt-imageio/blob/efb1267ca377959bedb9e1c64da426436cd2a3ce/daemon/ovirt_imageio/backends/http.py#L274

Finally, we have the client library, that does everything for you, and
the download_disk script
using it. If what you want it to download an image to to local file
system or block device,
creating image in raw or qcow2 format, you can use:
https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/download_disk.py

You need to use the API only if you want to consume the raw data
yourself and you don't
want to write the data to a file or block device.

Nir
_______________________________________________
Devel mailing list -- devel@ovirt.org
To unsubscribe send an email to devel-le...@ovirt.org
Privacy Statement: https://www.ovirt.org/privacy-policy.html
oVirt Code of Conduct: 
https://www.ovirt.org/community/about/community-guidelines/
List Archives: 
https://lists.ovirt.org/archives/list/devel@ovirt.org/message/W4Q72MSE2ZGQ2DBTXOOSCRK2AS5VRUIX/

Reply via email to