On Thu, Jun 10, 2021 at 04:16:27PM +0300, Nir Soffer wrote:
On Thu, Jun 10, 2021 at 2:52 AM Nir Soffer <nsoffer@redhat.com> wrote:
On Wed, Jun 9, 2021 at 9:01 PM Eric Blake <eblake@redhat.com> wrote:
I posted a work in progress patch implementing support for qemu:joint-allocaition in oVirt: https://gerrit.ovirt.org/c/ovirt-imageio/+/115197
The most important part is the nbd client: https://gerrit.ovirt.org/c/ovirt-imageio/+/115197/1/daemon/ovirt_imageio/_in...
With this our tests pass with qemu-nbd build with Eric patch: https://gerrit.ovirt.org/c/ovirt-imageio/+/115197/1/daemon/test/client_test....
Note that you _don't_ have to use qemu:joint-allocation; you could get the same information by using the already-existing qemu:allocation-depth. But your patch DOES make it obvious that it was a lot simpler to use a single context (the bulk of your tweak is trying an additional NBD_OPT_SET_META_CONTEXT), than it would be to handle parallel contexts (where you would have to tweak your NBD_CMD_BLOCK_STATUS handler to cross-correlate information).
We may need to use qemu:joint-allocation only for qcow2 images, and base:allocation for raw images, because allocation depth reporting is not correct for raw images. Since
Allocation depth (aka how deep in the backing chain is data allocated) IS correct for raw images (the raw image IS the source of all data); it is just not useful.
we control the qemu-nbd in both cases this should not be an issue. But it would be better if allocation depth would work for any kind of image, and we always use qemu:joint-allocation.
Maybe the thing to do is improve the documentation and try to avoid ambiguous terminalogy; in qemu:allocation-depth, a return of depth 0 should be called "absent", not "unallocated". And in libnbd, a base:allocation of 0 should be "data" or "normal", not "allocated". But I don't see how qemu will ever advertise an allocation depth of 0 for a raw image, because raw images have no backing chain to defer to. If you are trying to recreate a sparse raw image, then you really do want to pay attention to NBD_STATE_HOLE and NBD_STATE_ZERO, as those are more accurate pictures of the properties of extents within the raw file. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org