qemu-nbd: Use raw block driver for --offset
commitb57e4de079d90caca05fed5b45aeb642c6c29aa0
authorKevin Wolf <kwolf@redhat.com>
Thu, 24 Sep 2020 15:26:52 +0000 (24 17:26 +0200)
committerKevin Wolf <kwolf@redhat.com>
Fri, 2 Oct 2020 13:46:40 +0000 (2 15:46 +0200)
treeb76720bec980669ca9e4ee67aa92382e9a00ea5e
parent060102ad655544501b9d0d9f3fc8b8675883b463
qemu-nbd: Use raw block driver for --offset

Instead of implementing qemu-nbd --offset in the NBD code, just put a
raw block node with the requested offset on top of the user image and
rely on that doing the job.

This does not only simplify the nbd_export_new() interface and bring it
closer to the set of options that the nbd-server-add QMP command offers,
but in fact it also eliminates a potential source for bugs in the NBD
code which previously had to add the offset manually in all relevant
places.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20200924152717.287415-7-kwolf@redhat.com>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
blockdev-nbd.c
include/block/nbd.h
nbd/server.c
qemu-nbd.c