Re: [Libguestfs] [PATCH v3 00/14] qemu patches for 64-bit NBD extensions

2023-05-15 Thread Eric Blake
Adding qemu-block for the cover letter (not sure how I missed that the first time). On Mon, May 15, 2023 at 02:53:29PM -0500, Eric Blake wrote: > > v2 was here: > https://lists.gnu.org/archive/html/qemu-devel/2022-11/msg02340.html > > Since then: > - upstream NBD has accepted the extension

[Libguestfs] [PATCH v3 14/14] nbd/server: Add FLAG_PAYLOAD support to CMD_BLOCK_STATUS

2023-05-15 Thread Eric Blake
Allow a client to request a subset of negotiated meta contexts. For example, a client may ask to use a single connection to learn about both block status and dirty bitmaps, but where the dirty bitmap queries only need to be performed on a subset of the disk; forcing the server to compute that

[Libguestfs] [PATCH v3 11/14] nbd/client: Accept 64-bit block status chunks

2023-05-15 Thread Eric Blake
Because we use NBD_CMD_FLAG_REQ_ONE with NBD_CMD_BLOCK_STATUS, a client in narrow mode should not be able to provoke a server into sending a block status result larger than the client's 32-bit request. But in extended mode, a 64-bit status request must be able to handle a 64-bit status result,

[Libguestfs] [PATCH v3 12/14] nbd/client: Request extended headers during negotiation

2023-05-15 Thread Eric Blake
All the pieces are in place for a client to finally request extended headers. Note that we must not request extended headers when qemu-nbd is used to connect to the kernel module (as nbd.ko does not expect them), but there is no harm in all other clients requesting them. Extended headers are not

[Libguestfs] [PATCH v3 13/14] nbd/server: Prepare for per-request filtering of BLOCK_STATUS

2023-05-15 Thread Eric Blake
The next commit will add support for the new addition of NBD_CMD_FLAG_PAYLOAD during NBD_CMD_BLOCK_STATUS, where the client can request that the server only return a subset of negotiated contexts, rather than all contexts. To make that task easier, this patch populates the list of contexts to

[Libguestfs] [PATCH v3 09/14] nbd/server: Initial support for extended headers

2023-05-15 Thread Eric Blake
Time to support clients that request extended headers. Now we can finally reach the code added across several previous patches. Even though the NBD spec has been altered to allow us to accept NBD_CMD_READ larger than the max payload size (provided our response is a hole or broken up over more

[Libguestfs] [PATCH v3 10/14] nbd/client: Initial support for extended headers

2023-05-15 Thread Eric Blake
Update the client code to be able to send an extended request, and parse an extended header from the server. Note that since we reject any structured reply with a too-large payload, we can always normalize a valid header back into the compact form, so that the caller need not deal with two

[Libguestfs] [PATCH v3 08/14] nbd/server: Support 64-bit block status

2023-05-15 Thread Eric Blake
The NBD spec states that if the client negotiates extended headers, the server must avoid NBD_REPLY_TYPE_BLOCK_STATUS and instead use NBD_REPLY_TYPE_BLOCK_STATUS_EXT which supports 64-bit lengths, even if the reply does not need more than 32 bits. As of this patch, client->header_style is still

[Libguestfs] [PATCH v3 07/14] nbd/server: Refactor to pass full request around

2023-05-15 Thread Eric Blake
Part of NBD's 64-bit headers extension involves passing the client's requested offset back as part of the reply header (one reason for this change: converting absolute offsets stored in NBD_REPLY_TYPE_OFFSET_DATA to relative offsets within the buffer is easier if the absolute offset of the buffer

[Libguestfs] [PATCH v3 00/14] qemu patches for 64-bit NBD extensions

2023-05-15 Thread Eric Blake
v2 was here: https://lists.gnu.org/archive/html/qemu-devel/2022-11/msg02340.html Since then: - upstream NBD has accepted the extension on a branch; once multiple implementations interoperate based on that spec, it will be promoted to mainline (my plan: qemu with this series, libnbd nearly

[Libguestfs] [PATCH v3 04/14] nbd: Prepare for 64-bit request effect lengths

2023-05-15 Thread Eric Blake
Widen the length field of NBDRequest to 64-bits, although we can assert that all current uses are still under 32 bits. Move the request magic number to nbd.h, to live alongside the reply magic number. Convert 'bool structured_reply' into a tri-state enum that will eventually track whether the

[Libguestfs] [PATCH v3 01/14] nbd/client: Use smarter assert

2023-05-15 Thread Eric Blake
Assigning strlen() to a uint32_t and then asserting that it isn't too large doesn't catch the case of an input string 4G in length. Thankfully, the incoming strings can never be that large: if the export name or query is reflecting a string the client got from the server, we already guarantee that

[Libguestfs] [PATCH v3 03/14] nbd/server: Prepare for alternate-size headers

2023-05-15 Thread Eric Blake
Upstream NBD now documents[1] an extension that supports 64-bit effect lengths in requests. As part of that extension, the size of the reply headers will change in order to permit a 64-bit length in the reply for symmetry[2]. Additionally, where the reply header is currently 16 bytes for simple

[Libguestfs] [PATCH v3 06/14] nbd/server: Refactor handling of request payload

2023-05-15 Thread Eric Blake
Upcoming additions to support NBD 64-bit effect lengths allow for the possibility to distinguish between payload length (capped at 32M) and effect length (up to 63 bits). Without that extension, only the NBD_CMD_WRITE request has a payload; but with the extension, it makes sense to allow at least

[Libguestfs] [PATCH v3 02/14] nbd/client: Add safety check on chunk payload length

2023-05-15 Thread Eric Blake
Our existing use of structured replies either reads into a qiov capped at 32M (NBD_CMD_READ) or caps allocation to 1000 bytes (see NBD_MAX_MALLOC_PAYLOAD in block/nbd.c). But the existing length checks are rather late; if we encounter a buggy (or malicious) server that sends a super-large payload

[Libguestfs] [PATCH v3 05/14] nbd: Add types for extended headers

2023-05-15 Thread Eric Blake
Add the constants and structs necessary for later patches to start implementing the NBD_OPT_EXTENDED_HEADERS extension in both the client and server, matching recent commit e6f3b94a934] in the upstream nbd project. This patch does not change any existing behavior, but merely sets the stage. This

[Libguestfs] [v2v PATCH 2/2] LUKS-on-LVM conversion test: test /dev/mapper/VG-LV translation

2023-05-15 Thread Laszlo Ersek
In the LUKS-on-LVM conversion test, repeat the null conversion with such "--key" options that exercise the recent "/dev/mapper/VG-LV" -> "/dev/VG/LV" translation (unescaping) from libguestfs-common. Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2168506 Signed-off-by: Laszlo Ersek ---

[Libguestfs] [v2v PATCH 0/2] test "/dev/mapper/VG-LV" with "--key"

2023-05-15 Thread Laszlo Ersek
https://bugzilla.redhat.com/show_bug.cgi?id=2168506 This small set covers the new /dev/mapper/VG-LV "--key" ID format in the virt-v2v LUKS-on-LVM conversion test. It depends on: [libguestfs-common PATCH 0/2] recognize "/dev/mapper/VG-LV" with "--key" Message-Id:

[Libguestfs] [v2v PATCH 1/2] LUKS-on-LVM conversion test: rename VGs and LVs

2023-05-15 Thread Laszlo Ersek
In preparation for a subsequent patch, rename "VG" to "Volume-Group", and "LV" to "Logical-Volume-", in the LUKS-on-LVM conversion test. Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2168506 Signed-off-by: Laszlo Ersek --- test-data/phony-guests/make-fedora-img.pl | 30

Re: [Libguestfs] virt-v2v check-valgrind?

2023-05-15 Thread Richard W.M. Jones
On Mon, May 15, 2023 at 07:22:28PM +0200, Laszlo Ersek wrote: > Hi Rich, > > do we expect "make check-valgrind" to succeed in virt-v2v at the moment > (at commit e83de8abe6c5)? I see there's a "valgrind-suppressions" file > in the project root, but "make check-valgrind" still fails for me, with >

[Libguestfs] [libguestfs-common PATCH 0/2] recognize "/dev/mapper/VG-LV" with "--key"

2023-05-15 Thread Laszlo Ersek
https://bugzilla.redhat.com/show_bug.cgi?id=2168506 The commit message of the second patch explains the idea. The test suites in libguestfs, guestfs-tools and virt-v2v will have to be extended so they cover this feature; I'm soon going to post the virt-v2v update. I plan to cover the libguestfs

[Libguestfs] [libguestfs-common PATCH 2/2] options/keys: introduce unescape_device_mapper_lvm()

2023-05-15 Thread Laszlo Ersek
Introduce unescape_device_mapper_lvm() for turning /dev/mapper/VG-LV key IDs into /dev/VG/LV ones, unescaping doubled hyphens to single hyphens in both VG and LV in the process. Libguestfs uses the /dev/VG/LV format internally, for identifying devices, but the user might want to specify

[Libguestfs] [libguestfs-common PATCH 1/2] options/keys: key_store_import_key(): un-constify "key" parameter

2023-05-15 Thread Laszlo Ersek
The key_store_import_key() function is called from both C-language utilities -- via key_store_add_from_selector() -- and OCaml-language ones -- via guestfs_int_mllib_inspect_decrypt(). We currently declare the function's second parameter as const struct key_store_key *key That is however a

[Libguestfs] virt-v2v check-valgrind?

2023-05-15 Thread Laszlo Ersek
Hi Rich, do we expect "make check-valgrind" to succeed in virt-v2v at the moment (at commit e83de8abe6c5)? I see there's a "valgrind-suppressions" file in the project root, but "make check-valgrind" still fails for me, with numerous errors. I'm attaching the test suite log. (Compare

Re: [Libguestfs] [libnbd PATCH 0/6] finish wrapping generated C code harder

2023-05-15 Thread Laszlo Ersek
On 5/15/23 13:21, Richard W.M. Jones wrote: > > It all looks fine to me, barring comments that Eric has already made, > so ACK series. Thank you both for the reviews; merged as commit range d2d214c4e161..96fdc62ad59d. Phew. :) Laszlo ___ Libguestfs

Re: [Libguestfs] [libnbd PATCH 0/6] finish wrapping generated C code harder

2023-05-15 Thread Richard W.M. Jones
It all looks fine to me, barring comments that Eric has already made, so ACK series. Thanks, Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com nbdkit - Flexible, fast NBD server with