[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 17/28] test-block-iothread: Test adding parent to iot
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 17/28] test-block-iothread: Test adding parent to iothread node |
Date: |
Mon, 3 Jun 2019 17:02:22 +0200 |
Opening a new parent node for a node that has already been moved into a
different AioContext must cause the new parent to move into the same
context.
Signed-off-by: Kevin Wolf <address@hidden>
---
tests/test-block-iothread.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/tests/test-block-iothread.c b/tests/test-block-iothread.c
index 2200487d76..38f59999ab 100644
--- a/tests/test-block-iothread.c
+++ b/tests/test-block-iothread.c
@@ -663,6 +663,38 @@ static void test_propagate_mirror(void)
bdrv_unref(target);
}
+static void test_attach_second_node(void)
+{
+ IOThread *iothread = iothread_new();
+ AioContext *ctx = iothread_get_aio_context(iothread);
+ AioContext *main_ctx = qemu_get_aio_context();
+ BlockBackend *blk;
+ BlockDriverState *bs, *filter;
+ QDict *options;
+
+ blk = blk_new(ctx, BLK_PERM_ALL, BLK_PERM_ALL);
+ bs = bdrv_new_open_driver(&bdrv_test, "base", BDRV_O_RDWR, &error_abort);
+ blk_insert_bs(blk, bs, &error_abort);
+
+ options = qdict_new();
+ qdict_put_str(options, "driver", "raw");
+ qdict_put_str(options, "file", "base");
+
+ filter = bdrv_open(NULL, NULL, options, BDRV_O_RDWR, &error_abort);
+ g_assert(blk_get_aio_context(blk) == ctx);
+ g_assert(bdrv_get_aio_context(bs) == ctx);
+ g_assert(bdrv_get_aio_context(filter) == ctx);
+
+ blk_set_aio_context(blk, main_ctx, &error_abort);
+ g_assert(blk_get_aio_context(blk) == main_ctx);
+ g_assert(bdrv_get_aio_context(bs) == main_ctx);
+ g_assert(bdrv_get_aio_context(filter) == main_ctx);
+
+ bdrv_unref(filter);
+ bdrv_unref(bs);
+ blk_unref(blk);
+}
+
int main(int argc, char **argv)
{
int i;
@@ -678,6 +710,7 @@ int main(int argc, char **argv)
}
g_test_add_func("/attach/blockjob", test_attach_blockjob);
+ g_test_add_func("/attach/second_node", test_attach_second_node);
g_test_add_func("/propagate/basic", test_propagate_basic);
g_test_add_func("/propagate/diamond", test_propagate_diamond);
g_test_add_func("/propagate/mirror", test_propagate_mirror);
--
2.20.1
- [Qemu-block] [PULL 06/28] block/io: Delay decrementing the quiesce_counter, (continued)
- [Qemu-block] [PULL 06/28] block/io: Delay decrementing the quiesce_counter, Kevin Wolf, 2019/06/03
- [Qemu-block] [PULL 08/28] block/linux-aio: Drop unused BlockAIOCB submission method, Kevin Wolf, 2019/06/03
- [Qemu-block] [PULL 09/28] nvme: add Get/Set Feature Timestamp support, Kevin Wolf, 2019/06/03
- [Qemu-block] [PULL 07/28] iotests: Test cancelling a job and closing the VM, Kevin Wolf, 2019/06/03
- [Qemu-block] [PULL 10/28] test-block-iothread: Check filter node in test_propagate_mirror, Kevin Wolf, 2019/06/03
- [Qemu-block] [PULL 12/28] block: Add Error to blk_set_aio_context(), Kevin Wolf, 2019/06/03
- [Qemu-block] [PULL 11/28] nbd-server: Call blk_set_allow_aio_context_change(), Kevin Wolf, 2019/06/03
- [Qemu-block] [PULL 13/28] block: Add BlockBackend.ctx, Kevin Wolf, 2019/06/03
- [Qemu-block] [PULL 14/28] block: Add qdev_prop_drive_iothread property type, Kevin Wolf, 2019/06/03
- [Qemu-block] [PULL 15/28] scsi-disk: Use qdev_prop_drive_iothread, Kevin Wolf, 2019/06/03
- [Qemu-block] [PULL 17/28] test-block-iothread: Test adding parent to iothread node,
Kevin Wolf <=
- [Qemu-block] [PULL 19/28] block: Move node without parents to main AioContext, Kevin Wolf, 2019/06/03
- [Qemu-block] [PULL 16/28] block: Adjust AioContexts when attaching nodes, Kevin Wolf, 2019/06/03
- [Qemu-block] [PULL 20/28] blockdev: Use bdrv_try_set_aio_context() for monitor commands, Kevin Wolf, 2019/06/03
- [Qemu-block] [PULL 22/28] virtio-scsi-test: Test attaching new overlay with iothreads, Kevin Wolf, 2019/06/03
- [Qemu-block] [PULL 18/28] test-block-iothread: BlockBackend AioContext across root node change, Kevin Wolf, 2019/06/03
- [Qemu-block] [PULL 21/28] block: Remove wrong bdrv_set_aio_context() calls, Kevin Wolf, 2019/06/03
- [Qemu-block] [PULL 24/28] test-bdrv-drain: Use bdrv_try_set_aio_context(), Kevin Wolf, 2019/06/03
- [Qemu-block] [PULL 23/28] iotests: Attach new devices to node in non-default iothread, Kevin Wolf, 2019/06/03
- [Qemu-block] [PULL 25/28] block: Remove bdrv_set_aio_context(), Kevin Wolf, 2019/06/03
- [Qemu-block] [PULL 26/28] block/qcow2-refcount: add trace-point to qcow2_process_discards, Kevin Wolf, 2019/06/03