Skip to content

qapi: Allow blockdev-add for NBD

Max Reitz qemu-devel 5 versions – Applied

Status from this message: Thanks, applied to the block branch.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest13 patches 14 repliesApplied
  2. v412 patches 23 repliesSuperseded
  3. v314 patches 11 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v216 patches4 repliesSuperseded
v12 patches10 repliesSuperseded

Changes in v5 from the cover letter

- Patch 6:
- "server" instead of "address"
- Dropped comparison of key against "server" (or "address", previously), because all options are flattened anyway and it looks strange to assume otherwise here
- Use strstart() instead of strncmp()
- Reject use of the new server option and the legacy path/host/port options at the same time
- qdict_crumple() no longer has a @recursive parameter
- The former QMP visitors are now called QObject visitors
- Patch 7: Only rebase conflicts because of %s/address/server/g
- Patch 8: Same
- Patch 12: As explained above, comparing json: filenames against reference strings is not extremely clever. This new patch adds a function to compare such filenames against reference Python dicts (which is thus order-independent).
- Patch 13:
- %s/address/server/g
- Rebase conflict because of the blockdev-add parameter change
- Use the new assert_json_filename_equal() function from patch 12
- Delete the Unix socket file (if there is one) in tearDown()

Patches in v5 Applied

#Subject and filesSizeRepliesApplied
1/13block/nbd: Drop trailing "." in error messagesblock/nbd.c tests/qemu-iotests/051.out tests/qemu-iotests/051.pc.out+6 -60 replies
2/13block/nbd: Reject port parameter without hostblock/nbd.c+5 -20 replies
3/13block/nbd: Default port in nbd_refresh_filename()block/nbd.c+6 -130 replies
4/13block/nbd: Use qdict_put()block/nbd.c+6 -70 replies
5/13block/nbd: Add nbd_has_filename_options_conflict()block/nbd.c+20 -60 replies
6/13block/nbd: Accept SocketAddressblock/nbd.c tests/qemu-iotests/051.out tests/qemu-iotests/051.pc.out+117 -661 reply
7/13block/nbd: Use SocketAddress optionsblock/nbd.c+16 -101 reply
8/13qapi: Allow blockdev-add for NBDqapi/block-core.json+22 -34 replies
9/13iotests.py: Add qemu_nbd functiontests/qemu-iotests/iotests.py+8 -01 reply
10/13iotests.py: Allow concurrent qemu instancestests/qemu-iotests/iotests.py+4 -20 replies
11/13socket_scm_helper: Accept fd directlytests/qemu-iotests/socket_scm_helper.c+18 -110 replies
12/13iotests: Add assert_json_filename_equal() methodtests/qemu-iotests/iotests.py+20 -02 replies
13/13iotests: Add test for NBD's blockdev-add interfacetests/qemu-iotests/147 tests/qemu-iotests/147.out tests/qemu-iotests/group+202 -03 replies

Reviews trailers per patch

All 13 patches have a Reviewed-by or Acked-by.

PatchEric BlakeKevin Wolf
1/13R-b R-b
2/13R-b R-b
3/13R-b R-b
4/13R-b R-b
5/13R-b
6/13R-b
7/13R-b
8/13R-b R-b
9/13R-b
10/13R-b
11/13R-b
12/13R-b
13/13R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v5 thread

Cover letter [Qemu-devel] [PATCH v5 00/13] qapi: Allow blockdev-add for NBD

This series adds blockdev-add support for NBD clients.

Patches 1, 2, 3, and 4 are minor patches with no functional relation to this series, other than the fact that later patches will touch the code they touch, too.

Patch 5 prepares the code for the addition of a new option prefix, which is "server.".

Patch 6 makes the NBD client accept a SocketAddress under the "server" option (or rather, a flattened SocketAddress QDict with its keys prefixed by "server."). The old options "host", "port", and "path" are supported as legacy options and translated to the respective SocketAddress representation.

Patch 7 drops usage of "host", "port", and "path" outside of nbd_has_filename_options_conflict(), nbd_process_legacy_socket_options(), and nbd_refresh_filename(), making those options nothing but legacy.

Patch 8, the goal of this series, is again not very complicated.

Patches 9, 10, 11, and 12 are required for the iotest added in patch 13. It will invoke qemu-nbd, so patch 9 is required. Besides qemu-nbd, it will launch an NBD server VM concurrently to the client VM, which is why patch 10 is required. And finally, it will test whether we can add an NBD BDS by passing it a file descriptor, which patch 11 is needed for (so we use the socket_scm_helper to pass sockets to qemu).

During rebase of v5 I noticed that the order of keys in has changed when querying a json: filename. Instead of just adjusting the reference string, I decided to write a function for actually parsing such filenames and comparing them against reference dicts. This is implemented in patch 12.

Patch 13 then adds the iotest for NBD's blockdev-add interface.

***This series depends on qdict_crumple() as it has been merged by
Markus to his qapi-next branch (i.e. without @recursive).***

v5:
- Patch 6:
- "server" instead of "address"
- Dropped comparison of key against "server" (or "address", previously), because all options are flattened anyway and it looks strange to assume otherwise here
- Use strstart() instead of strncmp()
- Reject use of the new server option and the legacy path/host/port options at the same time
- qdict_crumple() no longer has a @recursive parameter
- The former QMP visitors are now called QObject visitors
- Patch 7: Only rebase conflicts because of %s/address/server/g
- Patch 8: Same
- Patch 12: As explained above, comparing json: filenames against reference strings is not extremely clever. This new patch adds a function to compare such filenames against reference Python dicts (which is thus order-independent).
- Patch 13:
- %s/address/server/g
- Rebase conflict because of the blockdev-add parameter change
- Use the new assert_json_filename_equal() function from patch 12
- Delete the Unix socket file (if there is one) in tearDown()

git-backport-diff against v4:

Key:
[----] : patches are identical
[####] : number of functional differences between upstream/downstream patch [down] : patch is downstream-only
The flags [FC] indicate (F)unctional and (C)ontextual differences, respectively

001/13:[----] [--] 'block/nbd: Drop trailing "." in error messages' 002/13:[----] [--] 'block/nbd: Reject port parameter without host' 003/13:[----] [--] 'block/nbd: Default port in nbd_refresh_filename()' 004/13:[----] [--] 'block/nbd: Use qdict_put()' 005/13:[----] [--] 'block/nbd: Add nbd_has_filename_options_conflict()' 006/13:[0093] [FC] 'block/nbd: Accept SocketAddress' 007/13:[0020] [FC] 'block/nbd: Use SocketAddress options' 008/13:[0004] [FC] 'qapi: Allow blockdev-add for NBD' 009/13:[----] [--] 'iotests.py: Add qemu_nbd function' 010/13:[----] [--] 'iotests.py: Allow concurrent qemu instances' 011/13:[----] [--] 'socket_scm_helper: Accept fd directly' 012/13:[down] 'iotests: Add assert_json_filename_equal() method' 013/13:[0081] [FC] 'iotests: Add test for NBD's blockdev-add interface'

Max Reitz (13):
block/nbd: Drop trailing "." in error messages block/nbd: Reject port parameter without host block/nbd: Default port in nbd_refresh_filename() block/nbd: Use qdict_put()
block/nbd: Add nbd_has_filename_options_conflict() block/nbd: Accept SocketAddress
block/nbd: Use SocketAddress options
qapi: Allow blockdev-add for NBD iotests.py: Add qemu_nbd function iotests.py: Allow concurrent qemu instances
socket_scm_helper: Accept fd directly
iotests: Add assert_json_filename_equal() method
iotests: Add test for NBD's blockdev-add interface

 block/nbd.c                            | 234 +++++++++++++++++++++------------
 qapi/block-core.json                   |  25 +++-
 tests/qemu-iotests/051.out             |   4 +-
 tests/qemu-iotests/051.pc.out          |   4 +-
 tests/qemu-iotests/147                 | 196 +++++++++++++++++++++++++++
 tests/qemu-iotests/147.out             |   5 +
 tests/qemu-iotests/group               |   1 +
 tests/qemu-iotests/iotests.py          |  34 ++++-
 tests/qemu-iotests/socket_scm_helper.c |  29 ++--
 9 files changed, 428 insertions(+), 104 deletions(-)
 create mode 100755 tests/qemu-iotests/147
 create mode 100644 tests/qemu-iotests/147.out
Signature · 1 line
2.10.1