All of lore.kernel.org
 help / color / mirror / Atom feed
* How to replace deprecated nbd-server-add by block-export-add
@ 2026-12-03 12:14 Markus Armbruster
  2026-12-03 17:06 ` Eric Blake
  2026-12-04 13:43 ` Kevin Wolf
  0 siblings, 2 replies; 7+ messages in thread
From: Markus Armbruster @ 2026-12-03 12:14 UTC (permalink / raw)
  To: qemu-devel; +Cc: Eric Blake, Kevin Wolf, Hanna Czenczek

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?


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-12-05  7:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 12:14 How to replace deprecated nbd-server-add by block-export-add Markus Armbruster
2026-12-03 17:06 ` 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

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.