All of lore.kernel.org
 help / color / mirror / Atom feed
* [PULL v2 00/15] NBD patches through 2026-10-08
@ 2026-10-12 21:29 Eric Blake
  2026-10-12 21:29 ` [PULL v2 02/15] qemu-nbd: Support -s and -l at the same time Eric Blake
  2026-10-14  8:02 ` [PULL v2 00/15] NBD patches through 2026-10-08 Richard Henderson
  0 siblings, 2 replies; 4+ messages in thread
From: Eric Blake @ 2026-10-12 21:29 UTC (permalink / raw)
  To: qemu-devel

The following changes since commit 615ece3c406b262996e569f29ea6eed0d81c4d8d:

  Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging (2026-10-09 15:49:53 +0200)

are available in the Git repository at:

  https://gitlab.com/ebblake/qemu.git tags/pull-nbd-2026-10-08-v2

for you to fetch changes up to 3d794bcd554c3dc196685faf382fdffe7243e674:

  iotests/iothreads-nbd-export: Skip on s390 (2026-10-12 16:23:50 -0500)

[v2: sending only the updated cover letter and patch 2/15]

----------------------------------------------------------------
NBD patches through 2026-10-08

Several fixes, including:
- Eric Blake: Update MAINTAINERS, support qemu-nbd -s -l
- Fiona Ebner: Report flush error on qemu-img convert
- Guillaume Vinke: Fix NBD client on dead connection
- Denis V. Lunev: Fix postcopy dirty bitmap migration
- Eric Farman: Several iotest improvements

----------------------------------------------------------------
Denis V. Lunev (3):
      migration: add QEMU_COUNTED_STRING_SIZE for counted string buffers
      migration/block-dirty-bitmap: fix postcopy abort with bitmaps on several nodes
      iotests/migrate-bitmaps-postcopy-test: add a bitmap on a second node

Eric Blake (2):
      maint: Update eblake's staging repo
      qemu-nbd: Support -s and -l at the same time

Eric Farman (4):
      iotests/nbd-in-qcow2-chain: use default machine
      iotests/nbd-tls-iothread: skip on non-x86 hardware
      iotests/fuse-truncate: skip if FUSE is not usable
      iotests/iothreads-nbd-export: Skip on s390

Fiona Ebner (4):
      iotests: add test cases for failing flush after qemu-img convert
      iotests.py: add filter_qemu()
      block: report flush error during bdrv_close()
      qemu-img: convert: flush target image after copying

Guillaume Vincke (2):
      nbd/client-connection: Fix client returning a closed channel
      iotests: Add coverage for NBD connect thread start delay

 docs/tools/qemu-nbd.rst                            |  7 +-
 include/migration/qemu-file-types.h                |  6 +-
 block.c                                            | 13 +++-
 migration/block-dirty-bitmap.c                     | 62 ++++++++++++++--
 migration/qemu-file.c                              |  5 +-
 nbd/client-connection.c                            | 32 +++++++++
 qemu-img.c                                         |  8 ++-
 qemu-nbd.c                                         | 22 +++++-
 MAINTAINERS                                        |  4 +-
 tests/qemu-iotests/026                             | 10 +--
 tests/qemu-iotests/026.out                         | 84 ++++++++++++++++++++++
 tests/qemu-iotests/071                             |  2 +-
 tests/qemu-iotests/071.out                         |  2 +
 tests/qemu-iotests/080.out                         |  2 +
 tests/qemu-iotests/098.out                         |  4 ++
 tests/qemu-iotests/122                             | 33 +++++++++
 tests/qemu-iotests/122.out                         | 17 +++++
 tests/qemu-iotests/244                             |  2 +-
 tests/qemu-iotests/244.out                         |  1 +
 tests/qemu-iotests/iotests.py                      |  4 ++
 tests/qemu-iotests/tests/file-io-error             |  2 +-
 tests/qemu-iotests/tests/file-io-error.out         |  2 +
 tests/qemu-iotests/tests/fuse-truncate             |  9 ++-
 tests/qemu-iotests/tests/iothreads-nbd-export      |  5 ++
 .../tests/migrate-bitmaps-postcopy-test            | 21 ++++++
 tests/qemu-iotests/tests/nbd-in-qcow2-chain        |  2 +-
 tests/qemu-iotests/tests/nbd-stale-connection      | 62 ++++++++++++++++
 tests/qemu-iotests/tests/nbd-stale-connection.out  | 17 +++++
 tests/qemu-iotests/tests/nbd-tls-iothread          |  4 ++
 tests/qemu-iotests/tests/qemu-nbd-snapshots        | 81 +++++++++++++++++++++
 tests/qemu-iotests/tests/qemu-nbd-snapshots.out    | 39 ++++++++++
 tests/qemu-iotests/tests/qsd-migrate               |  5 +-
 tests/qemu-iotests/tests/qsd-migrate.out           |  1 +
 33 files changed, 537 insertions(+), 33 deletions(-)
 create mode 100755 tests/qemu-iotests/tests/nbd-stale-connection
 create mode 100644 tests/qemu-iotests/tests/nbd-stale-connection.out
 create mode 100755 tests/qemu-iotests/tests/qemu-nbd-snapshots
 create mode 100644 tests/qemu-iotests/tests/qemu-nbd-snapshots.out

-- 
2.56.0



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

* [PULL v2 02/15] qemu-nbd: Support -s and -l at the same time
  2026-10-12 21:29 [PULL v2 00/15] NBD patches through 2026-10-08 Eric Blake
@ 2026-10-12 21:29 ` Eric Blake
  2026-10-14  8:02 ` [PULL v2 00/15] NBD patches through 2026-10-08 Richard Henderson
  1 sibling, 0 replies; 4+ messages in thread
From: Eric Blake @ 2026-10-12 21:29 UTC (permalink / raw)
  To: qemu-devel
  Cc: Vladimir Sementsov-Ogievskiy, Pierrick Bouvier, Kevin Wolf,
	Hanna Reitz, open list:Network Block Dev...

qemu-nbd already has the ability to wrap a read-write layer on top of
the export of a read-only image (-s) and the ability to export an
internal snapshot rather than the main image in a qcow2 file (-l
SNAPID).  But it gave a confusing error message when trying to mix the
two, because the snapshot overlay created first no longer has access
to the internal snapshots of the image being wrapped.

WIth a bit of finesse, this useful scenario is now supported.

https://gitlab.com/qemu-project/qemu/-/work_items/159

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-ID: <20260408021636.794794-2-eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
[eblake: improve test with Vladimir's suggestions, add lock to satisfy TSAN]
Signed-off-by: Eric Blake <eblake@redhat.com>
---
 docs/tools/qemu-nbd.rst                       |  7 +-
 qemu-nbd.c                                    | 22 ++++-
 tests/qemu-iotests/tests/qemu-nbd-snapshots   | 81 +++++++++++++++++++
 .../qemu-iotests/tests/qemu-nbd-snapshots.out | 39 +++++++++
 4 files changed, 143 insertions(+), 6 deletions(-)
 create mode 100755 tests/qemu-iotests/tests/qemu-nbd-snapshots
 create mode 100644 tests/qemu-iotests/tests/qemu-nbd-snapshots.out

diff --git a/docs/tools/qemu-nbd.rst b/docs/tools/qemu-nbd.rst
index f82ea5fd77b..336b4aa46e7 100644
--- a/docs/tools/qemu-nbd.rst
+++ b/docs/tools/qemu-nbd.rst
@@ -95,9 +95,10 @@ driver options if :option:`--image-opts` is specified.

 .. option:: -l, --load-snapshot=SNAPSHOT_PARAM

-  Load an internal snapshot inside *filename* and export it
-  as an read-only device, SNAPSHOT_PARAM format is
-  ``snapshot.id=[ID],snapshot.name=[NAME]`` or ``[ID_OR_NAME]``
+  Load an internal snapshot inside *filename* and export it.
+  SNAPSHOT_PARAM format is ``snapshot.id=[ID],snapshot.name=[NAME]``
+  or ``[ID_OR_NAME]``. The export is read-only unless ``-s`` is also
+  in use.

 .. option:: --cache=CACHE

diff --git a/qemu-nbd.c b/qemu-nbd.c
index ed5895861bb..fcca88932a3 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -534,6 +534,7 @@ int main(int argc, char **argv)
 {
     BlockBackend *blk;
     BlockDriverState *bs;
+    BlockDriverState *orig_bs;
     uint64_t dev_offset = 0;
     bool readonly = false;
     bool disconnect = false;
@@ -716,7 +717,7 @@ int main(int argc, char **argv)
             } else {
                 sn_id_or_name = optarg;
             }
-            /* fall through */
+            break;
         case 'r':
             readonly = true;
             flags &= ~BDRV_O_RDWR;
@@ -1110,6 +1111,15 @@ int main(int argc, char **argv)
     bdrv_init();
     atexit(qemu_nbd_shutdown);

+    /*
+     * -s and -l can be used together to create read-write wrapper
+     * around an internal snapshot. Otherwise, -l in isolation implies
+     * read-only.
+     */
+    if ((sn_opts || sn_id_or_name) && (flags & BDRV_O_SNAPSHOT) == 0) {
+        readonly = true;
+        flags &= ~BDRV_O_RDWR;
+    }
     opts.srcpath = argv[optind];
     if (imageOpts) {
         QemuOpts *o;
@@ -1155,13 +1165,19 @@ int main(int argc, char **argv)

     blk_set_enable_write_cache(blk, !writethrough);

+    orig_bs = bs;
+    if (flags & BDRV_O_SNAPSHOT) {
+        WITH_GRAPH_RDLOCK_GUARD() {
+            orig_bs = bs->backing->bs;
+        }
+    }
     if (sn_opts) {
-        ret = bdrv_snapshot_load_tmp(bs,
+        ret = bdrv_snapshot_load_tmp(orig_bs,
                                      qemu_opt_get(sn_opts, SNAPSHOT_OPT_ID),
                                      qemu_opt_get(sn_opts, SNAPSHOT_OPT_NAME),
                                      &local_err);
     } else if (sn_id_or_name) {
-        ret = bdrv_snapshot_load_tmp_by_id_or_name(bs, sn_id_or_name,
+        ret = bdrv_snapshot_load_tmp_by_id_or_name(orig_bs, sn_id_or_name,
                                                    &local_err);
     }
     if (ret < 0) {
diff --git a/tests/qemu-iotests/tests/qemu-nbd-snapshots b/tests/qemu-iotests/tests/qemu-nbd-snapshots
new file mode 100755
index 00000000000..ce62e97877b
--- /dev/null
+++ b/tests/qemu-iotests/tests/qemu-nbd-snapshots
@@ -0,0 +1,81 @@
+#!/usr/bin/env bash
+# group: rw quick
+#
+# Test qemu-nbd snapshot handling
+#
+# Copyright (C) Red Hat, Inc.
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+seq="$(basename $0)"
+echo "QA output created by $seq"
+
+status=1 # failure is the default!
+
+_cleanup()
+{
+    _cleanup_test_img
+    nbd_server_stop
+}
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+cd ..
+. ./common.rc
+. ./common.filter
+. ./common.nbd
+
+_supported_fmt qcow2
+_supported_proto file
+_supported_os Linux
+_require_command QEMU_NBD
+
+echo
+echo "=== Initial image setup ==="
+echo
+
+# Create qcow2 image with one internal snapshot
+_make_test_img 10M
+$QEMU_IO -c 'w -P 1 3M 1M' -f $IMGFMT "$TEST_IMG" | _filter_qemu_io
+$QEMU_IMG snapshot -c snap -f $IMGFMT "$TEST_IMG" | _filter_qemu_img
+$QEMU_IO -c 'w -P 2 3M 1M' -f $IMGFMT "$TEST_IMG" | _filter_qemu_io
+
+echo
+echo "=== Main image in snapshot mode ==="
+echo
+
+nbd_server_start_unix_socket -s -f qcow2 "$TEST_IMG"
+$QEMU_IO -c 'r -P 2 3M 1M' -c 'w -P 3 3M 1M' -c 'r -P 3 3M 1M' -f raw \
+  nbd:unix:$nbd_unix_socket | _filter_qemu_io
+nbd_server_stop
+
+echo
+echo "=== Read-only snapshot access ==="
+echo
+
+nbd_server_start_unix_socket -l snap -f qcow2 "$TEST_IMG"
+$QEMU_IO -r -c 'r -P 1 3M 1M' -f raw \
+  nbd:unix:$nbd_unix_socket | _filter_qemu_io
+$QEMU_IO -c 'r -P 1 3M 1M' -f raw \
+  nbd:unix:$nbd_unix_socket 2>&1 | _filter_qemu_io | _filter_testdir
+nbd_server_stop
+
+echo
+echo "=== Combine -s and -l for read-write internal snapshot access ==="
+echo
+
+nbd_server_start_unix_socket -s -l snap -f qcow2 "$TEST_IMG"
+$QEMU_IO -c 'r -P 1 3M 1M' -c 'w -P 3 3M 1M' -c 'r -P 3 3M 1M' -f raw \
+  nbd:unix:$nbd_unix_socket | _filter_qemu_io
+nbd_server_stop
+
+echo
+echo "=== Check that original image is unchanged ==="
+echo
+
+$QEMU_IO -c 'r -P 2 3M 1M' -f $IMGFMT "$TEST_IMG" | _filter_qemu_io
+
+# success, all done
+echo '*** done'
+rm -f $seq.full
+status=0
diff --git a/tests/qemu-iotests/tests/qemu-nbd-snapshots.out b/tests/qemu-iotests/tests/qemu-nbd-snapshots.out
new file mode 100644
index 00000000000..47289c30f1d
--- /dev/null
+++ b/tests/qemu-iotests/tests/qemu-nbd-snapshots.out
@@ -0,0 +1,39 @@
+QA output created by qemu-nbd-snapshots
+
+=== Initial image setup ===
+
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=10485760
+wrote 1048576/1048576 bytes at offset 3145728
+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 1048576/1048576 bytes at offset 3145728
+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+
+=== Main image in snapshot mode ===
+
+read 1048576/1048576 bytes at offset 3145728
+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 1048576/1048576 bytes at offset 3145728
+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+read 1048576/1048576 bytes at offset 3145728
+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+
+=== Read-only snapshot access ===
+
+read 1048576/1048576 bytes at offset 3145728
+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+qemu-io: can't open device nbd:unix:SOCK_DIR/qemu-nbd.sock: Could not open image: Permission denied
+
+=== Combine -s and -l for read-write internal snapshot access ===
+
+read 1048576/1048576 bytes at offset 3145728
+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 1048576/1048576 bytes at offset 3145728
+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+read 1048576/1048576 bytes at offset 3145728
+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+
+=== Check that original image is unchanged ===
+
+read 1048576/1048576 bytes at offset 3145728
+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+*** done
-- 
2.56.0



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

* Re: [PULL v2 00/15] NBD patches through 2026-10-08
  2026-10-12 21:29 [PULL v2 00/15] NBD patches through 2026-10-08 Eric Blake
  2026-10-12 21:29 ` [PULL v2 02/15] qemu-nbd: Support -s and -l at the same time Eric Blake
@ 2026-10-14  8:02 ` Richard Henderson
  2026-10-14 18:07   ` Eric Blake
  1 sibling, 1 reply; 4+ messages in thread
From: Richard Henderson @ 2026-10-14  8:02 UTC (permalink / raw)
  To: Eric Blake, qemu-devel

On 10/12/26 23:29, Eric Blake wrote:
> The following changes since commit 615ece3c406b262996e569f29ea6eed0d81c4d8d:
> 
>    Merge tag 'for-upstream' ofhttps://gitlab.com/bonzini/qemu into staging (2026-10-09 15:49:53 +0200)
> 
> are available in the Git repository at:
> 
>    https://gitlab.com/ebblake/qemu.git tags/pull-nbd-2026-10-08-v2
> 
> for you to fetch changes up to 3d794bcd554c3dc196685faf382fdffe7243e674:
> 
>    iotests/iothreads-nbd-export: Skip on s390 (2026-10-12 16:23:50 -0500)
> 
> [v2: sending only the updated cover letter and patch 2/15]
> 
> ----------------------------------------------------------------
> NBD patches through 2026-10-08
> 
> Several fixes, including:
> - Eric Blake: Update MAINTAINERS, support qemu-nbd -s -l
> - Fiona Ebner: Report flush error on qemu-img convert
> - Guillaume Vinke: Fix NBD client on dead connection
> - Denis V. Lunev: Fix postcopy dirty bitmap migration
> - Eric Farman: Several iotest improvements

This still has 13 job failures, including check-python-minreqs.

https://gitlab.com/qemu-project/qemu/-/pipelines/2945631627


r~


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

* Re: [PULL v2 00/15] NBD patches through 2026-10-08
  2026-10-14  8:02 ` [PULL v2 00/15] NBD patches through 2026-10-08 Richard Henderson
@ 2026-10-14 18:07   ` Eric Blake
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Blake @ 2026-10-14 18:07 UTC (permalink / raw)
  To: Richard Henderson; +Cc: qemu-devel

On Wed, Oct 14, 2026 at 10:02:46AM +0200, Richard Henderson wrote:
> On 10/12/26 23:29, Eric Blake wrote:
> > The following changes since commit 615ece3c406b262996e569f29ea6eed0d81c4d8d:
> > 
> >    Merge tag 'for-upstream' ofhttps://gitlab.com/bonzini/qemu into staging (2026-10-09 15:49:53 +0200)
> > 
> > are available in the Git repository at:
> > 
> >    https://gitlab.com/ebblake/qemu.git tags/pull-nbd-2026-10-08-v2
> > 
> > for you to fetch changes up to 3d794bcd554c3dc196685faf382fdffe7243e674:
> > 
> >    iotests/iothreads-nbd-export: Skip on s390 (2026-10-12 16:23:50 -0500)
> > 
> > [v2: sending only the updated cover letter and patch 2/15]
> > 
> > ----------------------------------------------------------------
> > NBD patches through 2026-10-08
> > 
> > Several fixes, including:
> > - Eric Blake: Update MAINTAINERS, support qemu-nbd -s -l
> > - Fiona Ebner: Report flush error on qemu-img convert
> > - Guillaume Vinke: Fix NBD client on dead connection
> > - Denis V. Lunev: Fix postcopy dirty bitmap migration
> > - Eric Farman: Several iotest improvements
> 
> This still has 13 job failures, including check-python-minreqs.
> 
> https://gitlab.com/qemu-project/qemu/-/pipelines/2945631627

Looks like most of the failures were due to the later runners being
canceled after the early failure of the check-python-minreqs syntax
check failure. At any rate, I figured out how to patch that one and
will be posting v3 shortly.

-------------------
************* Module tests.migrate-bitmaps-postcopy-test
tests/migrate-bitmaps-postcopy-test:146:8: W0201: Attribute 'drive1_sha256' defined outside __init__ (attribute-defined-outside-init)

Fixed by:
diff --git a/tests/qemu-iotests/tests/migrate-bitmaps-postcopy-test b/tests/qemu-iotests/tests/migrate-bitmaps-postcopy-test
index bada325e017..53f7dafc79a 100755
--- a/tests/qemu-iotests/tests/migrate-bitmaps-postcopy-test
+++ b/tests/qemu-iotests/tests/migrate-bitmaps-postcopy-test
@@ -115,6 +115,7 @@ class TestDirtyBitmapPostcopyMigration(iotests.QMPTestCase):
                                                           'discard=unmap')
         self.vm_b = iotests.VM(path_suffix='b').add_drive(disk_b,
                                                           'discard=unmap')
+        self.drive1_sha256 = ""
         # A bitmap on a second node makes postcopy switch nodes after setup
         self.vm_a.add_drive(disk_a1)
         self.vm_b.add_drive(disk_b1)


-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization:  qemu.org | libguestfs.org



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

end of thread, other threads:[~2026-10-14 18:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-12 21:29 [PULL v2 00/15] NBD patches through 2026-10-08 Eric Blake
2026-10-12 21:29 ` [PULL v2 02/15] qemu-nbd: Support -s and -l at the same time Eric Blake
2026-10-14  8:02 ` [PULL v2 00/15] NBD patches through 2026-10-08 Richard Henderson
2026-10-14 18:07   ` Eric Blake

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.