[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 11/28] nbd-server: Call blk_set_allow_aio_context_cha
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 11/28] nbd-server: Call blk_set_allow_aio_context_change() |
Date: |
Mon, 3 Jun 2019 17:02:16 +0200 |
The NBD server uses an AioContext notifier, so it can tolerate that its
BlockBackend is switched to a different AioContext. Before we start
actually calling bdrv_try_set_aio_context(), which checks for
consistency, outside of test cases, we need to make sure that the NBD
server actually allows this.
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
---
nbd/server.c | 1 +
tests/qemu-iotests/240 | 21 +++++++++++++++++++++
tests/qemu-iotests/240.out | 13 +++++++++++++
3 files changed, 35 insertions(+)
diff --git a/nbd/server.c b/nbd/server.c
index e21bd501dc..d1375350bc 100644
--- a/nbd/server.c
+++ b/nbd/server.c
@@ -1491,6 +1491,7 @@ NBDExport *nbd_export_new(BlockDriverState *bs, uint64_t
dev_offset,
goto fail;
}
blk_set_enable_write_cache(blk, !writethrough);
+ blk_set_allow_aio_context_change(blk, true);
exp->refcount = 1;
QTAILQ_INIT(&exp->clients);
diff --git a/tests/qemu-iotests/240 b/tests/qemu-iotests/240
index b4cf95096d..5be6b9c0f7 100755
--- a/tests/qemu-iotests/240
+++ b/tests/qemu-iotests/240
@@ -27,6 +27,12 @@ echo "QA output created by $seq"
status=1 # failure is the default!
+_cleanup()
+{
+ rm -f "$TEST_DIR/nbd"
+}
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
# get standard environment, filters and checks
. ./common.rc
. ./common.filter
@@ -122,6 +128,21 @@ run_qemu <<EOF
{ "execute": "quit"}
EOF
+echo
+echo === Attach a SCSI disks using the same block device as a NBD server ===
+echo
+
+run_qemu <<EOF
+{ "execute": "qmp_capabilities" }
+{ "execute": "blockdev-add", "arguments": {"driver": "null-co", "node-name":
"hd0", "read-only": true}}
+{ "execute": "nbd-server-start", "arguments":
{"addr":{"type":"unix","data":{"path":"$TEST_DIR/nbd"}}}}
+{ "execute": "nbd-server-add", "arguments": {"device":"hd0"}}
+{ "execute": "object-add", "arguments": {"qom-type": "iothread", "id":
"iothread0"}}
+{ "execute": "device_add", "arguments": {"id": "scsi0", "driver":
"${virtio_scsi}", "iothread": "iothread0"}}
+{ "execute": "device_add", "arguments": {"id": "scsi-hd0", "driver":
"scsi-hd", "drive": "hd0", "bus": "scsi0.0"}}
+{ "execute": "quit"}
+EOF
+
# success, all done
echo "*** done"
rm -f $seq.full
diff --git a/tests/qemu-iotests/240.out b/tests/qemu-iotests/240.out
index d76392966c..84e0a43ce5 100644
--- a/tests/qemu-iotests/240.out
+++ b/tests/qemu-iotests/240.out
@@ -51,4 +51,17 @@ QMP_VERSION
{"return": {}}
{"return": {}}
{"return": {}}
+
+=== Attach a SCSI disks using the same block device as a NBD server ===
+
+Testing:
+QMP_VERSION
+{"return": {}}
+{"return": {}}
+{"return": {}}
+{"return": {}}
+{"return": {}}
+{"return": {}}
+{"return": {}}
+{"return": {}}
*** done
--
2.20.1
- [Qemu-devel] [PULL 03/28] blockdev: fix missed target unref for drive-backup, (continued)
- [Qemu-devel] [PULL 03/28] blockdev: fix missed target unref for drive-backup, Kevin Wolf, 2019/06/03
- [Qemu-devel] [PULL 04/28] tests/perf: Test lseek influence on qcow2 block-status, Kevin Wolf, 2019/06/03
- [Qemu-devel] [PULL 02/28] iotests: Test commit job start with concurrent I/O, Kevin Wolf, 2019/06/03
- [Qemu-devel] [PULL 05/28] block: avoid recursive block_status call if possible, Kevin Wolf, 2019/06/03
- [Qemu-devel] [PULL 06/28] block/io: Delay decrementing the quiesce_counter, Kevin Wolf, 2019/06/03
- [Qemu-devel] [PULL 09/28] nvme: add Get/Set Feature Timestamp support, Kevin Wolf, 2019/06/03
- [Qemu-devel] [PULL 07/28] iotests: Test cancelling a job and closing the VM, Kevin Wolf, 2019/06/03
- [Qemu-devel] [PULL 08/28] block/linux-aio: Drop unused BlockAIOCB submission method, Kevin Wolf, 2019/06/03
- [Qemu-devel] [PULL 10/28] test-block-iothread: Check filter node in test_propagate_mirror, Kevin Wolf, 2019/06/03
- [Qemu-devel] [PULL 12/28] block: Add Error to blk_set_aio_context(), Kevin Wolf, 2019/06/03
- [Qemu-devel] [PULL 11/28] nbd-server: Call blk_set_allow_aio_context_change(),
Kevin Wolf <=
- [Qemu-devel] [PULL 13/28] block: Add BlockBackend.ctx, Kevin Wolf, 2019/06/03
- [Qemu-devel] [PULL 14/28] block: Add qdev_prop_drive_iothread property type, Kevin Wolf, 2019/06/03
- [Qemu-devel] [PULL 17/28] test-block-iothread: Test adding parent to iothread node, Kevin Wolf, 2019/06/03
- [Qemu-devel] [PULL 19/28] block: Move node without parents to main AioContext, Kevin Wolf, 2019/06/03
- [Qemu-devel] [PULL 16/28] block: Adjust AioContexts when attaching nodes, Kevin Wolf, 2019/06/03
- [Qemu-devel] [PULL 20/28] blockdev: Use bdrv_try_set_aio_context() for monitor commands, Kevin Wolf, 2019/06/03
- [Qemu-devel] [PULL 15/28] scsi-disk: Use qdev_prop_drive_iothread, Kevin Wolf, 2019/06/03
- [Qemu-devel] [PULL 22/28] virtio-scsi-test: Test attaching new overlay with iothreads, Kevin Wolf, 2019/06/03
- [Qemu-devel] [PULL 21/28] block: Remove wrong bdrv_set_aio_context() calls, Kevin Wolf, 2019/06/03
- [Qemu-devel] [PULL 18/28] test-block-iothread: BlockBackend AioContext across root node change, Kevin Wolf, 2019/06/03