]> git.proxmox.com Git - mirror_qemu.git/commit - nbd/client.c
nbd/client: Work around 3.0 bug for listing meta contexts
authorEric Blake <eblake@redhat.com>
Thu, 17 Jan 2019 19:36:57 +0000 (13:36 -0600)
committerEric Blake <eblake@redhat.com>
Mon, 21 Jan 2019 21:49:52 +0000 (15:49 -0600)
commit7c6f5ddca62905e67025aa0657e8a011cbdffa11
tree3265f47024862755978ed6054486d78e95878794
parent68b96f15838d309ef791cb83b5eec1bd7da271c2
nbd/client: Work around 3.0 bug for listing meta contexts

Commit 3d068aff forgot to advertise available qemu: contexts
when the client requests a list with 0 queries. Furthermore,
3.0 shipped with a qemu-img hack of x-dirty-bitmap (commit
216ee365) that _silently_ acts as though the entire image is
clean if a requested bitmap is not present.  Both bugs have
been recently fixed, so that a modern qemu server gives full
context output right away, and the client refuses a
connection if a requested x-dirty-bitmap was not found.

Still, it is likely that there will be users that have to
work with a mix of old and new qemu versions, depending on
which features get backported where, at which point being
able to rely on 'qemu-img --list' output to know for sure
whether a given NBD export has the desired dirty bitmap is
much nicer than blindly connecting and risking that the
entire image may appear clean.  We can make our --list code
smart enough to work around buggy servers by tracking
whether we've seen any qemu: replies in the original 0-query
list; if not, repeat with a single query on "qemu:" (which
may still have no replies, but then we know for sure we
didn't trip up on the server bug).

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20190117193658.16413-21-eblake@redhat.com>
nbd/client.c