All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@pond.sub.org>
To: qemu-devel@nongnu.org
Cc: Eric Blake <eblake@redhat.com>, Kevin Wolf <kwolf@redhat.com>,
	Hanna Czenczek <hreitz@redhat.com>
Subject: How to replace deprecated nbd-server-add by block-export-add
Date: Thu, 03 Dec 2026 13:14:23 +0100	[thread overview]
Message-ID: <87ik1ably8.fsf@pond.sub.org> (raw)

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) – Export name. If unspecified, the device
  parameter is used as the export name. (Since 2.12)

* description (string, optional) – Free-form description of the export,
  up to 4096 bytes. (Since 5.0)

* device (string) – The device name or node name of the node to be
  exported

* writable (boolean, optional) – Whether clients should be able to write
  to the device via the NBD connection (default false).

* bitmap (string, optional) – 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
  “qemu:dirty-bitmap:BITMAP” 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.

    · 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.

    · 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?


             reply	other threads:[~2026-12-03 12:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 12:14 Markus Armbruster [this message]
2026-12-03 17:06 ` How to replace deprecated nbd-server-add by block-export-add Eric Blake
2026-12-04  9:31   ` Markus Armbruster
2026-12-04  9:49     ` Markus Armbruster
2026-12-04 13:33     ` Kevin Wolf
2026-12-05  7:18       ` Markus Armbruster
2026-12-04 13:43 ` Kevin Wolf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ik1ably8.fsf@pond.sub.org \
    --to=armbru@pond.sub.org \
    --cc=eblake@redhat.com \
    --cc=hreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.