From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6A28C606A684 for ; Thu, 3 Dec 2026 12:15:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=pond.sub.org header.i=@pond.sub.org header.a=rsa-sha256 header.s=mail header.b=ZKIkB1fe Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xZ5hp-0006Ik-Qg; Thu, 03 Dec 2026 07:14:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xZ5ho-0006IX-Da for qemu-devel@nongnu.org; Thu, 03 Dec 2026 07:14:32 -0500 Received: from oxygen.pond.sub.org ([94.130.129.15]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xZ5hm-0003RW-1E for qemu-devel@nongnu.org; Thu, 03 Dec 2026 07:14:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=pond.sub.org; s=mail; t=1796300052; bh=DlaBAyMCP+UN3WXY/HbEuiWsKEUgJzqQkWOyVDt1BWs=; h=From:To:Cc:Subject:Date:From; b=ZKIkB1fe5i6/5NUwSlqvM7g29mU3RYV47s6ZNOiGyNrLH38aC/pP21UbJ4oDDqwVQ iMfwoHufIVfp41ZoBhcrpN9K4Wnqxc1Qmdt1g+RgJ35eLl4Yoh0boCoLfzzEqMwZwJ topx7YzrR0uNKK0wqO4rmrI3tYqKW0xtYzhCEX44= Received: from blackfin.pond.sub.org (p200300d36f05b900e5f885c0cd39d8e9.dip0.t-ipconnect.de [IPv6:2003:d3:6f05:b900:e5f8:85c0:cd39:d8e9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) by oxygen.pond.sub.org (Postfix) with ESMTPSA id 411621FF28 for ; Thu, 03 Dec 2026 13:14:12 +0100 (CET) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id A2F4721E6A04; Thu, 03 Dec 2026 13:14:23 +0100 (CET) From: Markus Armbruster To: qemu-devel@nongnu.org Cc: Eric Blake , Kevin Wolf , Hanna Czenczek Subject: How to replace deprecated nbd-server-add by block-export-add Date: Thu, 03 Dec 2026 13:14:23 +0100 Message-ID: <87ik1ably8.fsf@pond.sub.org> User-Agent: Gnus/5.13 (Gnus v5.13) X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=94.130.129.15; envelope-from=armbru@pond.sub.org; helo=oxygen.pond.sub.org X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org X-Spam-Status: No, score=-7.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 It's been years since commit 443127e81b9b (nbd: Deprecate nbd-server-add/remove) went into v5.2.0. I tried to remove it, but there are speedbumps: (1) The HMP commands still wrap around the deprecated QMP commands instead of their replacements or the internal interface. (2) There are several occurences in docs/. (3) There are quite a few occurences in tests/qemu-iotests/. I can take care of (1) on my own, but I'm having difficulties with replacing nbd-server-add by block-export-add for (2) and (3). Let me explain. nbd-server-add's handler qmp_nbd_server_add() wraps around internal blk_exp_add(), which is basically the same as QMP block-export-add. Okay. nbd-server-add takes the following arguments (according to the QEMU QMP Reference Manual): * name (string, optional) =E2=80=93 Export name. If unspecified, the device parameter is used as the export name. (Since 2.12) * description (string, optional) =E2=80=93 Free-form description of the exp= ort, up to 4096 bytes. (Since 5.0) * device (string) =E2=80=93 The device name or node name of the node to be exported * writable (boolean, optional) =E2=80=93 Whether clients should be able to = write to the device via the NBD connection (default false). * bitmap (string, optional) =E2=80=93 Also export a single dirty bitmap reachable from device, so the NBD client can use NBD_OPT_SET_META_CONTEXT with the metadata context name =E2=80=9Cqemu:dirty-bitmap:BITMAP=E2=80=9D to inspect the bitmap (since 4= .0). qmp_nbd_server_add() translates them to blk_exp_add() / block-export-add like this: block-export-add nbd-server-add @type BLOCK_EXPORT_TYPE_NBD @id @name or else @device @node-name node name of @device @writable @writable, possibly downgraded @bitmaps list containing @bitmap ` @name @name or else @device @description @description When replacing an nbd-server-add command by a block_export_type_nbd command * "@name or else @device" is not a problem: I pass one or the other to block_export_type_nbd. * "@writable, possibly downgraded" is only a minor problem: I need to take care not to ask for writable when the exported node isn't. * "node name of @device" is the spicy one: - If @device is a node name, I need to pass that. Not a problem. - If @device is a device name, I need to figure out its node name, and pass that. =C2=B7 If the thing was created with a user-specified node name, I need to find the command that created it in the test / the doc example. Not a problem. =C2=B7 Else, the node name is something QEMU made up on the spot, such = as "#block158". Problem: I can't predict that name. Is block-export-add missing a way to specify a device name? Or is exporting something without a node-name deprecated without replacement?