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 29E36606A322 for ; Fri, 4 Dec 2026 09:32:37 +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=jZfnqxeD Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xZPeO-0004Lq-2x; Fri, 04 Dec 2026 04:32:22 -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 1xZPdr-0004II-Jg for qemu-devel@nongnu.org; Fri, 04 Dec 2026 04:31:49 -0500 Received: from oxygen.pond.sub.org ([2a01:4f8:13b:3ad0:1::3]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xZPdn-00006J-Nj for qemu-devel@nongnu.org; Fri, 04 Dec 2026 04:31:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=pond.sub.org; s=mail; t=1796376685; bh=IuQYZwa1DFlLqL630hzqViQV1PqbWciuMXg/z2ujnoo=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=jZfnqxeDnpT7LfpMKUG6zz4aBuR5qY+IE8qS6Uv1g4+7hw991sLZX66YNpXeQ8eRp uXMIebGyD4gUQ5FwcPtn23tiPwEzUQg6/UhXL7Dv2n28z6wUZJAjkjL1YI9Hcu492c FdGMnG/pgSZxBLcYpmYUe4uE3OLZNz4YF2//y08Q= Received: from blackfin.pond.sub.org (p4fd045cf.dip0.t-ipconnect.de [79.208.69.207]) (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 DA2FA211EC for ; Fri, 04 Dec 2026 10:31:25 +0100 (CET) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 8E32221E6A04; Fri, 04 Dec 2026 10:31:37 +0100 (CET) From: Markus Armbruster To: Eric Blake Cc: qemu-devel@nongnu.org, Kevin Wolf , Hanna Czenczek Subject: Re: How to replace deprecated nbd-server-add by block-export-add In-Reply-To: (Eric Blake's message of "Thu, 3 Dec 2026 11:06:44 -0600") References: <87ik1ably8.fsf@pond.sub.org> Date: Fri, 04 Dec 2026 10:31:37 +0100 Message-ID: <87ik198k92.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=2a01:4f8:13b:3ad0:1::3; 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.5 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 Eric Blake writes: > On Thu, Dec 03, 2026 at 01:14:23PM +0100, Markus Armbruster wrote: >> 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: >>=20 >> (1) The HMP commands still wrap around the deprecated QMP commands >> instead of their replacements or the internal interface. >>=20 >> (2) There are several occurences in docs/. >>=20 >> (3) There are quite a few occurences in tests/qemu-iotests/. > > Instances in qemu-iotests are internal, so we should be able to update > them without holding up any deprecation action. More telling is > whether the out-of-date places in the iotests have been copied and > pasted into clients outside of QEMU, where our internal use of old > practices is prolonging their external use. I started looking into this with a "time to finish the job, should be easy, just collect the garbage" attitude. I've since come to to realize the deprecation was flawed: we left internal uses alone, and because of that didn't realize that converting from the deprecated interface to its proposed replacement is unreasonably hard. I now think the job that needs finishing is the deprecation, and that we probably should restart the grace period once that's done. [...] >> * "node name of @device" is the spicy one: >>=20 >> - If @device is a node name, I need to pass that. Not a problem. >>=20 >> - If @device is a device name, I need to figure out its node name, and >> pass that. >>=20 >> =C2=B7 If the thing was created with a user-specified node name, I n= eed >> to find the command that created it in the test / the doc example. >> Not a problem. >>=20 >> =C2=B7 Else, the node name is something QEMU made up on the spot, su= ch as >> "#block158". Problem: I can't predict that name. >>=20 >> Is block-export-add missing a way to specify a device name? > > Is it possible to see if a given string is a node name, and if not, > automatically check if it is a device name? We do that, but the other way round. We look up nodes by node name with bdrv_find_node(), and block backends by name with blk_by_name(). There's also bdrv_lookup_bs(), which looks up nodes by block backend or node name. It takes two arguments, block backend name @device and node name @node_name. If @device isn't null and blk_by_name(device) succeeds, it returns its node. Else if @node_name isn't null and bdrv_find_node(nodename) succeeds, it returns that. This enables several kinds of interfaces: * Accept both a device and a node name. This is problematic. What if you give both, and they resolve to different nodes? The device name would take precedence. Can't find examples in the schema, but see the next item. * Accept either a device or a node name, but not both. Example: block_resize, blockdev-snapshot-sync. As far as I can tell, these do not enforce "not both". Instead, the device name takes precedence. So this is actually the previous item's problematic interface. * Accept a single name with overloaded meaning, i.e. device or else node name. The parameter is commonly called @node-name, which could perhaps be confusing. Example: drive-backup, blockdev-backup, change-backing-file, block-commit, drive-mirror, blockdev-mirror, block-stream, blockdev-snapshot-internal-sync, blockdev-snapshot-delete-internal-sync, nbd-server-add. * Accept only node name. Example: blockdev-del, blockdev-set-active, block-set-write-threshold, blockdev-insert-medium, block-export-add. * Accept only device name. Can't find examples offhand. Having three kinds is unfortunate. But it is what it is. Changing block-export-add from "accept only node name" to "single name with overloaded meaning" would would take care of the spicy part of nbd-server-add to block-export-add conversion. But is this the interface we want for block-export-add? > You're right that node names are not always predictable, although > we've been encouraging people to use node names rather than rely on > generated ones. The generated node names cannot match device names, > but I recall that was intentional - the leading # is not valid in a > device name, so we gave ourselves a namespace such that any device > without a node name is guaranteed that it picks a node name that does > not collide; although the choice of names is non-deterministic to > avoid reliance on that algorithm. > >>=20 >> Or is exporting something without a node-name deprecated without >> replacement? > > The libvirt folks would need to double check that they have been > naming every node, and thus not relying on generated node names. I > think another way to word your question is "Have we reached the point > where use of generated node names is no longer supported", at which > point we can get rid of ALL support for #block158 naming in the code > base (a larger cleanup than just nbd-server-add changing to > block-export-add). I do not think we have reached this point. -hda, -cdrom, -drive, and so forth still create nodes with generated node names. > I think we've documented our intentions long enough, that I would be > in favor of eliminating support for generated node names. Whether we > can do it right away, or still need a couple more releases (but this > time with actual warning messages being output any time a name is > generated) may depend on what else we can dig up in the way of users > that did not create devices with explicit node names. I don't think we can eliminate now. Even deprecation would take additional work. We'd first have to make -hda and the like create node names, not just device names. And either do the same for -drive, or find a way to deprecate it. If deprecating -drive was easy, we would've done it years ago, I believe.