On 11/27/19 1:35 PM, Eric Blake wrote:
Changing this to:
extents = []
pos = 0
while pos < size:
res = c.extents(pos, size - pos)["base:allocation"]
for ext in res:
pos += ext.length
extents.append(ext)
Solves the issue:
https://travis-ci.org/nirs/ovirt-imageio/jobs/617846324
So I guess I answered my question but I would like to get
your opinion anyway.
Correct, the behavior is spec-compliant, even if annoying that it
doesn't make as much forward progress as is possible. Writing a loop in
the client is the correct behavior (the spec guarantees forward progress
on success, so at least that aspect of writing a loop is easier).
Oh, one other thing - your loop happens to work for your test case, but
will be thrown off if you ever get the same status in successive calls.
A more robust loop will coalesce consecutive ranges with the same status
before doing any comparison of whether the overall array matches an
expected pattern.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org